Question: I ' m having trouble fixing the errors in this code: / / DataTypes.cpp : The data types to declare each of the variables is

I'm having trouble fixing the errors in this code: // DataTypes.cpp : The data types to declare each of the variables is missing.
// Based on the value being stored in the variable and the comments beside it,
// fill in the data type at the beginning of each line. Then compile and run
// program to make sure you selected the correct types.
//
// After you submit your answers, try changing the values stored in the
// variables. What can you learn about the different data types?
//
//This line is causing an error where a ; is expected.
#include
#include
using namespace std;//Error on this line
main(){
float classAverage =90.7; //Decimal number. I added float to this line
char letterScore ='A'; //Single letter
int testScore =95; //Whole number value
float classTestAverage =88.4f; //Decimal number, notice the 'f' at the end
int colorCode{
Green =1;
Yellow =5;
Red =10;
}
int gradebookColor = colorCode; //Stores list of values
//gradebookColor = Green; //This line does not need a declaration, it was declared in the line above
//Since the line above was not necessary I made that line into a comment.
bool isStudentPassing = true; //Could be true or false
cout << "The class average is currently "
<< classAverage
<< endl;
cout << "The class test average was "
<< classTestAverage
<< endl;
cout << "Your test score was "
<< testScore
<< endl;
cout << "Your current letter score is "
<< letterScore
<< endl;
cout << "The color of your gradebook entry is "
<< gradebookColor
<< endl;
cout << "Are you passing? "
<< bool boolalpha //This line allows the word 'true' or 'false' to be printed instead of '0' or '1'
<< isStudentPassing
<< endl;
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!