Reading a list of integers
Apr 30, 2018 at 11:46pm UTC
Hello!
I'm trying to write a program that reads in a list of grades and prints converts them into letter grades and implement a loop in which the above actions are repeated until the user requests to quit.
I can only get the program to read one user input (since cin only allows one). How can I get it to read the entire list at once? Thanks!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
#include<iostream>
using namespace std;
int main()
{
int grade;
char cont = 'y' ;
while (cont == 'y' )
{
cout << "Enter a list of total scores: " ;
cin >> grade;
if (grade <= 56)
cout << grade << " -> F" ;
else if (grade <= 59)
cout << grade << " -> D-" ;
else if (grade <= 63)
cout << grade << " -> D" ;
else if (grade <= 66)
cout << grade << " -> D+" ;
else if (grade <= 69)
cout << grade << " -> C-" ;
else if (grade <= 72)
cout << grade << " -> C" ;
else if (grade <= 76)
cout << grade << " -> C+" ;
else if (grade <= 79)
cout << grade << " -> B-" ;
else if (grade <= 82)
cout << grade << " -> B" ;
else if (grade <= 86)
cout << grade << " -> B+" ;
else if (grade <= 89)
cout << grade << " -> A-" ;
else
cout << grade << " -> A" ;
cout << endl;
cout << "Continue? (y/n) " ;
cin >> cont;
cout << endl;
}
return 0;
}
Last edited on Apr 30, 2018 at 11:47pm UTC
May 1, 2018 at 1:44am UTC
Your question is unclear. What's wrong with your program?
Topic archived. No new replies allowed.