I need help with a code for averaging grades it works on a online compiler but it doesn't work on visual studio 2019
#include <iostream> using namespace std; int main() float firstgrade, secondgrade, thirdgrade, fourthgrade; cout << "Enter your grades: ">> intl; cin >> firstgrade >> secondgrade >> thirdgrade >> fourthgrade; // Determining letter grades const int A = 90, B = 80, C = 70, D = 60; float average=0.0; average = (float)(firstgrade + secondgrade + thirdgrade + fourthgrade) / 4; cout << "The average of their grades is: " << average; //What is your letter grade? if (average >= 90) cout << "Your average is an A. \n"; else if (average >= 80) cout << "Your average is a B. \n"; else if (average >= 70) cout << "Your average is a C. \n"; else if (average >= 60) cout << "Your average is a D. \n"; else if (average >= 0) cout << "Your average is an F. \n"; else cout << "Invalid test score.\n"; return 0;
It may be too late for you to fix your post. That first line in such a big font states include but what?
Also take time to share what's not working and the error messages since many may not load up your project to see what is amiss. Besdes the first few lines look off to me.
# as the first char so it was interpreted as
heading, thus the big font. I fixed it and now you can see the target as
Now that your code display is fixed can you answer more questions?
There's more but as presented this won't work in any C++ compiler I know of.