This is an assignment that i have to have for entry to c++ and I cant wrap my brain around enum. To me it looks like an array but backwards so instead of a number to a value now its a value to a number. Researching around I found it starts at 0 so now im thinking its an array of of some kind?
This issue i believe is what is causeing the confusion i have for the assignment. I got like 95% of it done but the gradebookColor is getting me due to enum.
Only code i can edit or modify must be noted with a comment the professor provided
Note: I dont know if the out put is suppose to be Green or 1
#include <cstdlib>
#include <iostream>
//#include <pch> //causes errors
using namespace std;```
int main()
{
double classAverage = 90.7; //Decimal number use of double due to small decimal_point
char letterScore = 'A'; //Single letter use of char due to is be a single string letter
int testScore = 95; //Whole number value unknown if could be negative so signed int is used,also is a whole number
float classTestAverage = 88.4f; //Decimal number, notice the 'f' at the end use float due to the f
enum colorCode {
Green = 1,
Yellow = 5,
Red = 10
};gradebookColor; //Stores list of values
gradebookColor = Green; //This line does not need a declaration, it was declared in the line above
bool isStudentPassing = true; //Could be true or false bool deals only in 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? "
<< boolalpha //This line allows the word 'true' or 'false' to be printed instead of '0' or '1'
<< isStudentPassing
<< endl;
return 0;
}