cpp_primer_plus/ch04/01.cpp
2022-08-25 00:37:24 +01:00

25 lines
537 B
C++

# include <iostream>
# include <string>
using namespace std;
int main(){
string f_nm, l_nm;
char grad[5] = "ABCD";
int year, i;
char t;
cout << "What is your first name? ";
getline(cin, f_nm);
cout << "What is your last name? ";
getline(cin, l_nm);
cout << "What letter grade do you deserve? ";
cin >> t;
for (i=0; t != grad[i]; i++);
i++;
cout << "What is your age? ";
cin >> year;
cout << "Name: " << l_nm << ", " << f_nm << endl;
cout << "Grade: " << grad[i] << endl;
cout << "Age: " << year << endl;
return 0;
}