The results you're getting make sense, if you indent the code and look:
Code:
#include <iostream>
using namespace std;
using std::cout;
using std::cin;
using std::endl;
int grade;
int letter;
void getScore(int & grade);
void printGrade (int & letter);
int main()
{
void getScore(int & grade);
{
cout<< "Please enter a number grade: ";
cin>> grade;
}
void printGrade(int & letter);
if ( grade >= 90 )
cout << "Your final grade is A";
else if ( grade >= 80 )
cout << "Your final grade is B";
else if ( grade >= 70 )
cout << "Your final grade is C";
else if ( grade >= 60 )
cout << "Your final grade is D";
else
cout << "Your final grade is F";
cin.get();
cin.get();
}
All the braces match up conspicuously to make a valid program, and it turns out that the other mistakes you made, while unwanted, are harmless.
It's obvious to a human what you want though. The parts of a function are actually pretty simple.
Code:
void getScore(int & grade);
This is a function prototype. Apart from the symbols we have lots of words. The blue part is called a return type, which is just the type of the value returned by the return statement. In this case it is void because nothing is returned. Then you have the orange part which is the function's name. Then you have the parameter types indicated in pink, in a list, in parentheses. Each parameter has an optional name, indicated in grey.
When you define the program function elsewhere, you need braces, indicated in green.
Code:
void printGrade(int & grade)
{
if ( grade >= 90 )
cout << "Your final grade is A";
else if ( grade >= 80 )
cout << "Your final grade is B";
else if ( grade >= 70 )
cout << "Your final grade is C";
else if ( grade >= 60 )
cout << "Your final grade is D";
else
cout << "Your final grade is F";
cin.get();
cin.get();
}
Note that the semicolon is left off. This is correct.
Now when you call a function, you have to consider the usefulness of the return value if there is one. You probably want to store the value in a variable. For the rest of it, you want to type out the name and fill the parameter list with arguments. Arguments are just variables that (typically) come from the calling function.
So, part of writing good code is not just reading and understanding the errors but considering the code. Hopefully this -- exactly this -- doesn't happen too often!