| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 666 人关注过本帖
标题:我的第二段程序updatemarking运行不了,请帮忙看一下原因
只看楼主 加入收藏
救人如救火
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2018-5-25
结帖率:100%
收藏
已结贴  问题点数:20 回复次数:2 
我的第二段程序updatemarking运行不了,请帮忙看一下原因
#include <stdio.h>
#include <string.h>
#define N 10

void printMarks(char id[10][7],int marks[10]);
void updateMarks(char id[10][7],int marks[10]);
    int main()
  {
    char id[10][7];// student ID consist by 6 numbers
    int marks[10];
    int i=0;
     
    for(i = 0; i < N; i++)//save values for the student ID and marks
       {
        printf("Enter student ID and student mark: ");
        scanf("%s %d",id[i],&marks[i]);
               
        }
    printf("Students Mark\n");
    for(i = 0; i < N; i ++)//show all student ID and marks
    {    printf("%s %d \n",id[i],marks[i]);
             }
    }
           


void updateMarks(char id[10][7],int marks[10])//update the marks


{   
    char nid[7];
    int i,j,c;
   
    while (c="N")// make a loop countinue ask update the score, if the answer is no, finish the programm.
     {
     printf("Do you want to update the score? Y/N\n");
        scanf("%d",&c);
             if (feof(stdin)||ferror(stdin))
               break;
       if  (c='Y') // if the answer is yes, do the update programme
        {
            printf("Please enter student ID and score:");// ask new student id and new score to update the information
            scanf("%s",nid);   
            for(i = 0; i < 10; i ++)//
              {   
                if(strcmp(id[i], nid) == 0)//compare the student id
                   {
                    printf("Please enter student ID and score:");
                     scanf("%s %d",id, &marks);
                    /**for(i = 0; i < N; i ++)//show all student ID and marks
                    {    printf("%s %d \n",id[i],marks[i]);
                     }
                    break; **/
            }
               /** else {printf("This id is not exitsts")// if the id is wrong exist for loop
                      break;}**/
                /**if(i == 10) printf("");
                else printf("%d\n", );**/
               }
         }
    }
    printf("thanks for using our system, see you");
   
}
搜索更多相关主题的帖子: student for the and printf 
2018-05-25 19:09
dzy123
Rank: 8Rank: 8
等 级:蝙蝠侠
威 望:5
帖 子:379
专家分:820
注 册:2013-4-18
收藏
得分:14 
while (c="N")c是整形变量不能给和字符串比较并且比较是'=='还有你没有调用updatamark()

[此贴子已经被作者于2018-5-25 19:19编辑过]

2018-05-25 19:17
救人如救火
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2018-5-25
收藏
得分:0 
回复 2楼 dzy123
十分感谢,请允许我问一个白痴的问题,怎么调用updateMarks?
2018-05-25 19:48
快速回复:我的第二段程序updatemarking运行不了,请帮忙看一下原因
数据加载中...
 
   



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

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