Write a program that takes four assignment scores, name of the student, and course from the keyboard; store them, and print.
#include <iostream>
#include <string>
using std::string;
using std::cin;
using std::getline;
using std:: cout;
using std::endl;
int main()
{
int scores [4];
string name;
int course;
// input data student
cout << "Enter student's name: ";
getline(cin, name);
cout << "Enter student scores: " << endl;
for (int i = 0; i < 4; i++)
{
cout << "Enter " << i + 1 << " score";
cin >> scores[i];
}
cout << "Enter student's course: ";
cin >> course;
// output data student
cout << "Student name :" << name << endl;
cout << "Student scores : ";
for (int i = 0; i < 4; i++)
{
cout << scores[i] << " ";
}
cout << endl;
cout << "Student course :" << course << endl;
return 0;
}
Comments
Leave a comment