Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Performance Indexing In SQL Server

Authors: Jason Strate, Grant Fritchey

2nd Edition

1484211189, 9781484211182

More Books

Students also viewed these Databases questions

Question

3. Give examples of four fair disciplinary practices.

Answered: 1 week ago

Question

4. Explain how to use fair disciplinary practices.

Answered: 1 week ago