1. read the scores using cin 2. compute the average (what type?) 3. print the result
#include <iostream>
using namespace std;
const int NUM_SCORES = 3;
int main()
{
int score1, score2, score3;
float average;
cout << "Enter the 3 scores separated by spaces: ";
cin >> score1 >> score2 >> score3;
average = float(score1 + score2 + score3) / float(NUM_SCORES);
cout << "The average is " << average << endl;
return 0;
}
char ans1, ans2, ans3, ans4; cin >> ans1 >> ans2 >> ans3 >> ans4;problem: skips spaces
cin.get(ans1); cin.get(ans2); cin.get(ans3); cin.get(ans4);
long id; ??? name; cin >> id >> name;
cin.ignore('\n');
long id;
cin >> id;
cin.ignore('\n');