Hey, im new to the forum and im trying to learn c++, so i bought a book.
On a programming exercise i was asked to create a program that would take a persons full name, letter grade, then subtract the letter grade (ie: A to B), and age and display it on the screen.
Everything was working fine until i tried to work out the part to subtract the letter grade.
Here is the link to the programming exercise page (no.1): http://books.google.com/books?id=zuyAIZ9ZIskC&pg=PA153&lpg=PA153&dq=c%2B%2B+primer+plus+betty+sue&source=bl&ots=mbx4P-t2HX&sig=4nn3Mqs9YUMY25BcvYC9EN_fQTs&hl=en&ei=HPRFTI3dI4vSsAOgsoCyAg&sa=X&oi=book_result&ct=result&resnum=1&ved=0CBYQ6AEwAA#v=onepage&q&f=false
My code:
#include <iostream>
#include <string>
int main()
{
using namespace std;
string name;
string lastname;
char grade[6] = {"ABCDF"};
char gradez [1];
cout << "What is your first name?";
getline(cin, name);
cout << "What is your last name?";
getline(cin, lastname);
cout << "What letter grade do you deserve?";
cin >> gradez;
gradez = grade[] + 1;
cout << "Name:" << lastname << name<<endl;
cout << "Grade: " << gradez;
return 0;
}
Everything works fine untill i try to match what letter grade the user typed in to the different grades on the array (fourth or fifth line from the bottom).
Please help me figure this out.
Thanks.