I have been trying to write this program and i have no idea what i am doing. I don't understand alot of the C++ language. I just know the basic stuff. So if some one could help me that would be great!!!! I will give you the program later
// Declare Arrays
int menuChoice = 0;
string FN[20] = {""};
string LN[20] = {""};
int SS = 0;
char RG = ' ';
int TP = 20;
double TPR = 0;
int i = 0;
double percent = 0.0;
char grade = ' ';
int points, points1, points2, points3, points4, points5, points6, points7, points8, points9 = 0;
char AN[10] = {' '} ;
char t, f = ' ' ;
char CA[10] = {t,f,f,t,f,f,f,f,t,f} ;
char A, B, C, D, F = ' ';
system("cls");
// Prompt User for information
do
{
cout << "1 - Enter Student Information";
cout << "2 - Chapter 13 Quiz";
cout << "3 - Grade Chapter 13 Quiz";
cout << "4 - Exit Program";
cout << "Please enter Menu Choice (1-4) and press enter";
cin >> menuChoice;
if (menuChoice == 1)
{
cout << "Please enter First Name: ";
cin >> FN[i];
cout << "Please enter Last Name: ";
cin >> LN[i];
cout << "Please enter Social Security: ";
cin >> SS;
}
else if (menuChoice == 2)
{
cout << "Please use lower case for following questions" <<endl;
cout << "t or f: A double type is an example of a simple data type: " ;
cin >> AN[0];
cout << "t or f: A function can return a value of type array: " ;
cin >> AN[1];
cout << "t or f: A variable name can't be passed to a value parameter: " ;
cin >> AN[2];
cout << "t or f: A value-returning function returns only one value " ;
cin >> AN[3];
cout << "t or f: tThe instance variables of a class must be of the same type: " ; cin >> AN[4];
cout << "t or f: The member functions of a class must be public: " ;
cin >> AN[5];
cout << "t or f: The results of a logical expression can't be assigned to a bool variable: " ;
cin >> AN[6];
cout << "t or f: in C++, both ! and != are logical expressions: " ;
cin >> AN[7];
cout << "t of f: The function ignore is used to skip certain input in a line: " ; cin >> AN[8];
cout << "t or f: A C++ identifier can start with a digit; " ;
cin >> AN[9];
}
else if (menuChoice == 3)
{
if (AN[0] == CA[0])
{
points = 2;
}
else
{
points = 0;
}
if (AN[1] == CA[1])
{
points1 = 2;
}
else
{
points1 = 0;
}
if (AN[2] == CA[2])
{
points2 = 2;
}
else
{
points2 = 0;
}
if (AN[3] == CA[3])
{
points3 = 2;
}
else
{
points3 = 0;
}
if (AN[4] == CA[4])
{
points4 = 2;
}
else
{
points4 = 0;
}
if (AN[5] == CA[5])
{
points5 = 2;
}
else
{
points5 = 0;
}
if (AN[6] == CA[6])
{
points6 = 2;
}
else
{
points6 = 0;
}
if (AN[7] == CA[7])
{
points7 = 2;
}
else
{
points7 = 0;
}
if (AN[8] == CA[8])
{
points8 = 2;
}
else
{
points8 = 0;
}
if (AN[9] == CA[9])
{
points9 = 2;
}
else
{
points9 = 0;
}
TPR = points + points1 + points2 + points3 + points4 + points5 + points6 + points7 + points8 + points9;
percent = TPR / TP;
do
{
cout << "T or F: A double type is an example of a simple data type: " ;
cout << "T or F: A function can return a value of type array: " ;
cout << "T or F: A variable name can't be passed to a value parameter: " ;
cout << "T or F: A value-returning function returns only one value " ;
cout << "T or F: The instance variables of a class must be of the same type: " ;
cout << "T or F: The member functions of a class must be public: " ;
cout << "T or F: The results of a logical expression can't be assigned to a bool variable: " ;
cout << "T or F: in C++, both ! and != are logical expressions: " ;
cout << "T of F: The function ignore is used to skip certain input in a line: " ;
cout << "T or F: A C++ identifier can start with a digit; " ;
cout << setw(15) << SS << " " << FN[i] << " " << LN[i] << " " << CA[i] << " " << AN[i] << " " << TP << " " << TPR << " " << percent << " " << grade << " " << endl;
i++;
}
while (i >= 20);
}
write a program that allows 20 students to take a quiz(one person at a time)
use two functions
use one array
have a main menu that displays:
1 - students information
2 - chapter quiz
3 - grade
4 - exit program
i put the question on there
i have to display everything
the full name
SS number
the quetions
the right anwswers
what the student answered
if they got the question right
how many points they got( each quetions is worth 2 points)
there percent
and the letter grade they got
cout << "Please enter your choice: ";
cin >> menuChoice;
if (menuChoice == 1)
{
cout << "Please enter First Name: ";
cin >> FN[i];
cout << "Please enter Last Name: ";
cin >> LN[i];
cout << "Please enter Social Security: ";
cin >> SS;
goto top;
}
else if (menuChoice == 2)
{
cout << "First name " << FN << endl;
cout << "Last name " << LN << endl;
cout << "Social Security Number " << SS << endl;
cout << "Please use lower case for following questions" <<endl;
cout << "t or f: A double type is an example of a simple data type: " ;
cin >> AN[0];
cout << "t or f: A function can return a value of type array: " ;
cin >> AN[1];
cout << "t or f: A variable name can't be passed to a value parameter: " ;
cin >> AN[2];
cout << "t or f: A value-returning function returns only one value " ;
cin >> AN[3];
cout << "t or f: tThe instance variables of a class must be of the same type: " ;
cin >> AN[4];
cout << "t or f: The member functions of a class must be public: " ;
cin >> AN[5];
cout << "t or f: The results of a logical expression can't be assigned to a bool variable: " ;
cin >> AN[6];
cout << "t or f: in C++, both ! and != are logical expressions: " ;
cin >> AN[7];
cout << "t of f: The function ignore is used to skip certain input in a line: " ;
cin >> AN[8];
cout << "t or f: A C++ identifier can start with a digit; " ;
cin >> AN[9];
No, you didn't. You assigned char literals to grade, not the variables A, B, C, D, F themselves. F is probably generating no warning because you initialized it.
No! Don't do that! If your going to use a char for that reason, there's no reason to use them at all! The reason to hold a character is so it can change variably, not hold a constant character. If that were the case, then character variables would be almost useless.