| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1024 人关注过本帖
标题:修改一个图书管理系统的程序,用VC写的,没有错误只有警告但是运行不了
取消只看楼主 加入收藏
sundayday158
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2012-9-5
收藏
 问题点数:0 回复次数:2 
修改一个图书管理系统的程序,用VC写的,没有错误只有警告但是运行不了
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<string.h>
#include<math.h>
struct yx
{
    int num[10];
    char name[10];
    char author[10];
    int amount[4];
};
void yxxx();
void yxxt();
void informationmenu();
void checkmenu();

int mainmenu()
{
    system("cls");
    printf("*******************************************\n");
    printf("欢迎来到英雄联盟!\n\n");
    printf("\t\t 1.英雄信息系统\n\n");
    printf("\t\t 2.退出英雄系统\n\n");
    printf("*******************************************\n");
    printf("选择\n");
    return 0;
}
void informationtable()
{
    system("cls");
    printf("欢迎来到英雄联盟!\n");
    printf("*******************************************\n");
    printf("\t\t1.英雄信息录入\n");
    printf("\t\t2.英雄信息检查\n");
    printf("\t\t3.英雄信息记录\n");
    printf("\t\t4.返回到主菜单\n");
    printf("*******************************************\n");
}
void checktable()
{
    system("cls");
    printf("欢迎来到英雄联盟!\n");
    printf("*******************************************\n");
    printf("\t\t1.英雄编号\n");
    printf("\t\t2.英雄名字\n");
    printf("\t\t3.英雄类型\n");
    printf("\t\t4.返回到英雄信息界面\n");
    printf("*******************************************\n");
}
void main1()
{
    char choose;
    mainmenu();
    scanf("%c",&choose);
    switch(choose)
    {
    case'1':yxxx();break;
    case'2':system("cls");
        printf("\n\n\n\n\n\n\n\n\n\t\t\t      再见....");
        getch();
        exit(0);
    }
}
void yxxx()
{
    char choose;
    informationmenu();
}
void yxin();
void checkyx();
void check();
void tj();
main()
{
    main1();
    getch();
}
void informationmenu()
{
    char choose;
    informationtable();
    printf("请选择一个选项! :");
    scanf("%c",&choose);
    switch(choose)
    {
    case'1':yxin();break;
    case'2':checkyx();break;
    case'3':tj();break;
    case'4':mainmenu();
    }
}
void checkyx()
{
    char choose;
    checkmenu();
}
void checkmenu()
{
    char choose;
    checktable();
    check();
}
void yxin()
{
    char num1[10];
    char name1[20];
    char author1[10];
    char ch;
    int amount1[4];
    struct yx temp;
    FILE*fp;
    printf("\n\n欢迎添加一个英雄!");
    /*if((fp)==NULL)
    {
        printf("THE FILE DOSEN'T EXIST!!!");
        fp=fopen("D:\\yxin.txt","w");
        fclose(fp);
    }*/
    fp=fopen("D:\\yxin.txt","w+");
    ch='y';
    do{
        printf("\n\n输入一个新英雄(number;yxname;author;amount;)\n\n");
        scanf("%s %s %s %s",num1,name1,author1,amount1);
        fprintf(fp,"%s         %s         %s         %s",temp.num,temp.name,temp.author,temp.amount);
        printf("输入y继续录入");
        ch=getch();
    }
    while(ch=='y');
    fclose(fp);
    printf("\n储存成功!!!\n");
    printf("");
}
int yxsj()
{
    FILE*fp;
    int tnum=0,tamount=0,n;
    char tname[20]={'\0'},tauthor[20]={'\n'};
    fp=fopen("D:\\yxin","rb");
    for(n=0;!feof(fp);n++)
        fscanf(fp,"%s  %s  %s  %s",&tnum,tname,tauthor,&tamount);
    n--;
    fclose(fp);
    return(n);
}
void check()
{
    FILE*fp;
    char choose;
    int tnum=0,ttnum=0,tamount=0,k,i,l,c;
    char tname[20]={'\n'},ttname[20]={'\0'},tauthor[20]={'\0'},ttauthor[20]={'\0'};
    if((fp=fopen("D:\\yxin","rb"))==NULL)
    {
        printf("\n\n\n\n\n\n\n\n\n\t\t\t文件没有被找到!任意键返回.");
        getch();
        informationtable();
    }
    l=yxsj();
    checktable();
    scanf("%c",&choose);
    if(choose=='4')
        informationtable();
    else if(choose=='1')
    {
        system("cls");
        printf("输入英雄编号:");
        scanf("%s",ttnum);
    }
    else if(choose=='2')
    {
        system("cls");
        printf("输入英雄名字:");
        scanf("%s",ttname);
    }
    else if(choose=='3')
    {
        system("cls");
        printf("输入英雄类型:");
        scanf("%s",ttauthor);
    }
    system("cls");
    for (i=0;i<1;i++)
    {
        fscanf(fp,"%s%s%s%s",tnum,tname,tauthor,tamount);
        k==(!strcmp(ttnum,tnum)||!strcmp(ttname,tname)||!strcmp(ttauthor,tauthor));
        if(k!=0)
        {
            printf("\t\t\t\t搜索结果:\n\n");
            printf("\tyxnum\t\tyxname\tyxauther\tyxamount \n");
            printf("\t%s\t\t%s\t\t%s\t\t%s\n",tnum,tname,tauthor,tamount);
            printf("\n\t\t你确定是这个英雄?(YorN)\n\n");
            scanf("%c",c);
            if(c=='Y')tamount--;
            printf("\t\t现有英雄数量是\t%s",tamount);
        }
        if(k==0)
        {
            system("cls");
            printf("\n\n\n\n\n\n\n\t\t\t\t一个也没有!\n");
            getch();
            yxxx();
        }
    }
    fclose(fp);
    getch();
    yxxx();
}
搜索更多相关主题的帖子: include 系统 void amount system 
2012-09-05 14:17
sundayday158
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2012-9-5
收藏
得分:0 
C:\Documents and Settings\Administrator\桌面\1.c(67) : warning C4101: 'choose' : unreferenced local variable
C:\Documents and Settings\Administrator\桌面\1.c(95) : warning C4101: 'choose' : unreferenced local variable
C:\Documents and Settings\Administrator\桌面\1.c(100) : warning C4101: 'choose' : unreferenced local variable
C:\Documents and Settings\Administrator\桌面\1.c(185) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int '
C:\Documents and Settings\Administrator\桌面\1.c(185) : warning C4024: 'strcmp' : different types for formal and actual parameter 1
C:\Documents and Settings\Administrator\桌面\1.c(185) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int '
C:\Documents and Settings\Administrator\桌面\1.c(185) : warning C4024: 'strcmp' : different types for formal and actual parameter 2
C:\Documents and Settings\Administrator\桌面\1.c(185) : warning C4553: '==' : operator has no effect; did you intend '='?
C:\Documents and Settings\Administrator\桌面\1.c(193) : warning C4047: '==' : 'int ' differs in levels of indirection from 'char [2]'
C:\Documents and Settings\Administrator\桌面\1.c(114) : warning C4700: local variable 'fp' used without having been initialized
C:\Documents and Settings\Administrator\桌面\1.c(186) : warning C4700: local variable 'k' used without having been initialized
C:\Documents and Settings\Administrator\桌面\1.c(192) : warning C4700: local variable 'c' used without having been initialized

1.obj - 0 error(s), 0 warning(s)
2012-09-05 14:18
sundayday158
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2012-9-5
收藏
得分:0 
说我CHOOSE没有定义,但是我感觉我定义了啊
2012-09-05 14:19
快速回复:修改一个图书管理系统的程序,用VC写的,没有错误只有警告但是运行不了 ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017885 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved