当前位置:编程学习 > C/C++ >>

一道有点难度的C语言题目 帮帮小弟

我们有2个array里面有10个elements, 一行是学生的ID, 一行是分数。 学生ID是一个有8个characteristics的string, ((7 numbers plus the end of string mark '\0', A valid student numbers start with a '1', an input of 0 is used to exit the program, 这个是说每个学生ID后面加'\0', 输入开头字母是1的学生ID 能查成绩, 如果输入第一个数字是0就推出程序)。 写一个C编程 里面有2个input, ID 和 mark 如果 学生ID 存在, 那么出现成绩 如果不存在 就出现 no marks 英文原文见下 We have two arrays of 10 elements: a list of students IDs and a list of marks. The main method and test data is defined in the file attached. The student ID is a string with 8 characters (7 numbers plus the end of string mark '\0', A valid student numbers start with a '1', an input of 0 is used to exit the program. Write the function called update_mark which has two input parameters: a student ID and a mark. If the student exist, it will increment their mark and print the new mark. If it does not exist it will print a message saying so. Hint: review the code you wrote in the workshop for find. Now you need to find a string instead of an integer, and use the index of the student ID to update their mark
答案:#include <stdio.h>

void main()
{
 int price[4] = ;
 int num[4] = ;
 int sum = 0;
 for (int i = 0; i < 4; i++)
 {
  sum += price[i]*num[i];
 }
 printf("The total money is %d.\n", sum);
}

……难点何在?还是我理解错意思了?

上一个:C语言 指针与数组 加减问题 不知道哪里错了
下一个:用牛顿迭代法求方程f(x)=x^6-x-1=0在区间【1,2】内的实根,要求|f(x(k))|<10^-8 用C语言编写此编程

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,