Not declared in Scope
c++
Solution
You need to let it be known that those functions exist so add prototypes for your functions above `main` or define your functions there. Like so:
...
double inputExam(string examType);
double inputAndAvgLabs();
double inputAndAvgQuizzes();
int main() { ... }
//definitions after main
..or copy paste all those definitions above the call to `main` like so:
...
// Function defs here
// Prototypes no longer needed
...
int main() {...}
// Defs no longer needed here
Alternatively you can put all the definitions in an external file and compile it into the project via a `make` file or better yet, and as you progress, create classes in header and implementation files and include them in your file the same way(sort of) that you do `#include <iostream>`.
Another small nugget of advice would be to avoid `using namespace std;`. If not only in theory it's bad practice and can lead to namespace clashing in larger projects. If you, like me, hate typing `std::string ...` then add `using std::string;` to your code for the same ease of use.
Problem
I have wrote a simple average calculation program trying to calculate a semester average. When I compile the code I get an error telling me my 'inputExam' function was not declared in this scope. I've researched the error message and I can't figure out what to do to fix it. I also get this error for the other functions, but once I understand my error I think I can fix the others. ``` #include <iostream> using namespace std; int main() { double finalExam=0.0; double midterm = 0.0; double quizzes = 0.0; double labs = 0.0; double semGrade=0.0; midterm=inputExam("Midterm"); finalExam=inputExam("Final"); quizzes=inputAndAvgQuizzes(); labs=inputAndAvgLabs(); semGrade=(midterm*.2)+(finalExam*.2)+(labs*.5)+(quizzes*.1); cout<<"Your End of Semester Grade is: " semGrade; return 0; } double inputExam(string examType) { double grade; cout<< "Enter the " examType " Score: "; cin>>grade; return (grade); } double inputAndAvgLabs() { double num [4]; double sum; double avg; if (int a=0, a<3,a++) { cout<<"What is the grade?"<<endl; cin>>num[a]>>endl; } if (int a=0, a<3, a++) { sum=sum+num[a]; } avg=sum/4; return avg; } double inputAndAvgQuizzes() { double num[3]; double sum; double avg; double lowest = num[0]; if (int a=0, a<2,a++) { cout<<"What is the grade?"<<endl; cin>>num[a]>>endl; } if (lowest>num[1]) { lowest=num[1]; } if (lowest>num[2]) { lowest=num[2]; } sum=num[1]+num[2]+num[3]-lowest; avg=sum/2; return avg; } ```