I am taking an introductory course in Comp Science. Last Chapter deals with C++ Programming. I have struggled through the semester but happy to annouce a 76 average. However, C++ is going to be the death of me! Can someone explain why this program won't compile? I believe it has something to do with my int declarations.....I think!?
Code:
//Student Weighted Grade Average//
#include <iostream>
using namespace std;
int main()
{
int L1, L2, L3, T1, T2, X, W1, W2, W3, A1, B1;
double avg;
cout<<"Type Each Lab Score and then Press Enter" << endl;
cin>>L1>>L2>>L3;
avg = (L1+L2+L3)/(3.0)*.30;
cout<<"Your Weighted Lab Average Is:" <<avg<<endl;
cout<<"Type Each Test Score and then Press Enter"<< endl;
cin>>T1>>T2;
avg = (T1+T2)/ (2.0)*.40;
cout<<"Your Weighted Test Average Is:" <<avg<<endl;
cout<<"Type Your Final Exam Score and then Press Enter" << endl;
cin>>X;
A1 = (X*.30);
cout <<"Type Your Weighted Averages and then Press Enter"<<endl;
cin>>W1>>W2>>W3;
B1 = (A1+avg+avg);
if(B1 >=90)
cout<<"Your Final Grade is: A" <<endl;
else if (avg >=80)
cout<<"Your Final Grade is: B" <<endl;
else if (avg >=70)
cout<<"Your Final Grade is: C" <<endl;
else if (avg >=60)
cout <<"Your Final Grade is: D" <<endl;
else if (avg <59)
cout<<"You Have Not Passed This Course" << endl;
system("PAUSE");
return 0;
}
Please help!