You already have it right. but average = ((midterm + final) / 2); should be just before return average; so the average is calculated with the values from the user, and not 0 (or whatever they were initialized to)
Also, you cannot use cin on strings. Use getline(cin, stringname); instead.
int main () {
string s;
cout << "enter a string: ";
cin >> s;
cin.ignore();
cout << s;
getchar();
return 0;
}
i guess if the first name or last name have spaces in it, you would need getline, but you can use cin just like you could with c-strings. unless it's compiler dependent or something
I just like getline() better because it is much more versatile.
Huh? Not really. You use the two for different things, the >> operator to get the next word (seperated by whitespace) and getline to get an entire line.