Answer to Question #182605 in C++ for John Veloz

Question #182605

Write a program that takes four assignment scores, name of the student, and course from the keyboard; store them, and print. 


1
Expert's answer
2021-04-17T15:53:58-0400
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS