| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 4335 人关注过本帖
标题:有没有高手能帮我修改一个C语言程序?
只看楼主 加入收藏
daniel_zeng
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2014-5-29
结帖率:0
收藏
已结贴  问题点数:20 回复次数:1 
有没有高手能帮我修改一个C语言程序?
代码如下
#include <process.h>
#include <string.h>
#include <stdio.h>
void zj();                                                                       
void find();                                                                           //查找某同学的量化分的函数
struct  stu
{char *name;
long int number;
float garde;
char reason;
}boy[3]={
    {"张三",201401001,0,,'\0'},
    {"李四",201401002,0,,'\0'},
        {"王五",201401003,0,,'\0'},
};

main()
{
printf("**********************************************************************\n");
printf("*****                                                            *****\n");
printf("*****                                                            *****\n");
printf("*****                                                            *****\n");
printf("*****             1.查询量化分                                   *****\n");
printf("*****             2.添加量化分                                   *****\n");
printf("*****                                                            *****\n");
printf("*****                                                            *****\n");
printf("*****                                                            *****\n");
printf("**********************************************************************\n");
scanf("%d",&choose);
if (choose==1)
find();
if (choose==2)
zj();

void zj()                                                                       //添加量化分
int i ;                                                                 //定义变量
char e;
float a=0.0000;
   for (i=0;i<3;i++)  
   {again:
   printf("************************************");
   printf("     姓名:    ","%s\n",boy[i].name);
   printf("     学号:    ","%d\n",boy[i].number);
   printf("     量化分:  ","%f\n",boy[i].garde);
   printf("     加分细则:","%s\n",boy[i].reason);
   printf("************************************");
   printf("     请输入量化分数,输入0则跳转下一名同学");                             //输入量化分细则
   scanf("%f\n",&a);
   if (a==0)
    continue;                                                                        //跳转下一位
   printf("     请输入量化分加分细则");                                   //选择细则,或输入细则
   scanf("%c\n",&e);
   printf("     您输入的量化分数为:\n");                                          //打印所输入的内容
   printf("%f\n",a);
   printf("     您输入的量化分加分细则为:\n");
   printf("%s\n",e);
   printf("是否保存?不保存请输入n,任意键保存");                                //选择是否保存
   scanf("%d",&choose);
    if (choose==n)                                                                    //如果不保存,返回again处
     goto again;
       boy[i].garde+=a;
       strcat(boy[i].reason,e);
     return(boy[i].garde,boy[i].reason);}
 
void find()                                                                            //查找某同学的量化分的函数
int a,find,i;
again: printf("请输入查询学生的姓名或学号");                                           //查询学生的姓名或学号
scanf("%s\n",&find);
for(i=0;i<3;i++)                                                                     //查找
 if (boy[i].name==find|| boy[i].number)                                                                  //如果查找的是姓名
 {printf("************************************");
   printf("     姓名:    ","%s\n",boy[i].name);
   printf("     学号:    ","%d\n",boy[i].number);
   printf("     量化分:  ","%f\n",boy[i].garde);
   printf("     加分细则:","%s\n",boy[i].reason);
   printf("************************************");
      printf("是否继续查找?不查找请输入n,,其余任意键继续查询,");                      //询问是否继续查找
      scanf("%d",&choose);
    if (choose==n)                                                                              //退出查找
          continue;
       goto again;}
搜索更多相关主题的帖子: include number reason C语言 
2014-05-29 15:12
tlliqi
Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19Rank: 19
等 级:贵宾
威 望:204
帖 子:15453
专家分:65956
注 册:2006-4-27
收藏
得分:20 
不会c语言
2014-05-30 00:13
快速回复:有没有高手能帮我修改一个C语言程序?
数据加载中...
 
   



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

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