Hey my name is Josh and I am new to C++. I have a simple project due in a week and i cannot pinpoint two errors. If anyone can help that would be great.
here are the errors that I have:Code:#include <iostream> // include standard I/O libraries #include <iomanip> using namespace std; int main () { // the constant weights for all scoring items const double P1_WEIGHT = 0.02; const double P2_WEIGHT = 0.10; const double P3_TO_P6_WEIGHT = 0.13; const double EXAM_WEIGHT = 0.18; int p1score, // scores on the 6 programs p2score, p3score, p4score, p5score, p6score, exam1score, // scores on the 2 exams exam2score, double wtdTotalGrd; // the weighted total grade as calculated // write the main output heading cout << "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=" << endl; cout << "Welcome to the Weighted Grade Calculator Program" << endl; cout << "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=" << endl << endl; // ask the user to type in the program grades first cout << "Please enter your score on program 1 -> "; cin >> p1score; cout << " program 2 -> "; cin >> p2score; cout << " program 3 -> "; cin >> p3score; cout << " program 4 -> "; cin >> p4score; cout << " program 5 -> "; cin >> p5score; cout << " program 6 -> "; cin >> p6score; // now ask the user to type in the exam scores cout << endl << "Please enter your score on exam 1 -> "; cin >> exam1score; cout << " exam 2 -> "; cin >> exam2score; // echoprint all of the user's scores to verify accuracy cout << endl << "You have entered the following scores:" << endl; cout << "\tProgram 1: " << p1score << endl; cout << "\tProgram 2: " << p2score << endl; cout << "\tProgram 3: " << p3score << endl; cout << "\tProgram 4: " << p4score << endl; cout << "\tProgram 5: " << p5score << endl; cout << "\tProgram 6: " << p6score << endl; cout << "\tExam 1: " << exam1score << endl; cout << "\tExam 2: " << exam2score << endl << endl; // calculate the weighted total grade as a real number cout << wtdTotalGrd = (p1score * P1_WEIGHT) + (p2score * P2_WEIGHT)[/B] + ((p3score + p4score + p5score + p6score) * P3_TO_P6_WEIGHT) + ((exam1score + exam1score) * EXAM_WEIGHT); // now print the weighted total with 2 digits past the decimal point cout << fixed << showpoint << setprecision(2); cout << "Your weighted total is: " << wtdTotalGrd << endl; // print a closing message and signal normal termination cout << endl << "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-="; cout << endl << "Program Run Completed." << endl; cout << "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n"; return 0; }
Error 1 error C2062: type 'double' unexpected 57
Error 2 error C2065: 'wtdTotalGrd' : undeclared identifier 96
Here are the lines where the errors are.
double wtdTotalGrd; // the weighted total grade as calculated
cout << wtdTotalGrd = (p1score * P1_WEIGHT) + (p2score * P2_WEIGHT)
+ ((p3score + p4score + p5score + p6score) * P3_TO_P6_WEIGHT)
+ ((exam1score + exam1score) * EXAM_WEIGHT);[/B]
If anyone can help explain why these are errors that would be great. Thanks for the help