Honeysuckle34556 2019-10-18 22:06 采纳率: 0%
浏览 627

C++学生成绩系统代码编译错误求助

7-1 Score Processing (20 分)

Write a program to process students score data.
The input of your program has lines of text, in one of the two formats:
Student's name and student id, as , , and
Score for one student of one course, as , , .
Example of the two formats are:
3190101234, Zhang San
3190101111, Linear Algebra, 89.5
Comma is used as the seperator of each field, and will never be in any of the fields. Notice that there are more than one word for name of the person and name of the course. To make your code easier, the score can be treated as double.
The number of the students and the number of the courses are not known at the beginning. The number of lines are not known at the beginning either. The lines of different format appear in no order. One student may not get enrolled in every course.
Your program should read every line in and print out a table of summary in .csv format.
The first line of the output is the table head, consists fields like this:
student id, name, , , ..., average
where the course names are all the courses read, in alphabet order. There should be one space after each comma.
Then each line of the output is data for one student, in the ascended order of their student id, with score of each course, like:
3190101234, Zhang San, 85.0, , 89.5, , , 87.3
For the course that hasn't been enrolled, leave a blank before the comma, and should not get included in the average. The average has one decimal place. There should be one space after each comma.
And the last line of the output is a summary line for average score of every course, like:
, , 76.2, 87.4, , , 76.8
All the number output, including the averages have one decimal place.
Input Format
As described in the text above.
Output Format
As described in the text above. The standard output is generated by a program compiled by gcc, that the round of the first decimal place is in the "gcc way".
Sample Input
3180111435, Operating System, 34.5
3180111430, Linear Algebra, 80
3180111435, Jessie Zhao
3180111430, Zhiwen Yang
3180111430, Computer Architecture, 46.5
3180111434, Linear Algebra, 61.5
3180111434, Anna Teng
Sample Output
student id, name, Computer Architecture, Linear Algebra, Operating System, average
3180111430, Zhiwen Yang, 46.5, 80.0, , 63.2
3180111434, Anna Teng, , 61.5, , 61.5
3180111435, Jessie Zhao, , , 34.5, 34.5
, , 46.5, 70.8, 34.5, 50.6

定义了class student和class lesson存储学生和课程信息。。。
用map存储学生信息和成绩
set存储课程名
怎么把这些片段结合在一起。。。
而且cin显示 does not name a type的语法错误

  • 写回答

1条回答 默认 最新

  • threenewbee 2019-10-19 09:15
    关注

    层序没有贴出来,所以不知道。
    你是不是定义了一个叫cin的变量,和std::cin冲突了
    或者你没有用using namespace std;所以cin没有识别

    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!