我正在为我的基础课程制定一个非常基本的计划,并且我的所有内容 98% 都按预期工作。
这个程序取三个年级的名字,取平均值,然后将它们输出到一个表中,但由于assignmentName[]
与 位于同一行代码,它会向右
grade[]
推确定用户输入的字符数。问题截图grade[]
这是我目前为表编写的代码:
cout << "___________________________\n";
cout << name << "'s Grade Chart\n";
cout << "---------------------------\n";
cout << setprecision(1) << fixed;
cout << "Grade for " << assignmentName[0] << setw(8) << grade[0] << endl;
cout << "Grade for " << assignmentName[1] << setw(8) << grade[1] << endl;
cout << "Grade for " << assignmentName[2] << setw(8) << grade[2] << endl;
cout << "\nYour average grade between those three assignments is: " << setw(1) << avg << endl;`