New Program would like some help or suggestions

/*
Program Topic:The program should display a menu allowing the user to select an addition, subtraction, multiplication, or division problem. The final selection on the menu should let the user quit the program.

After the user has finished the math problem, the program should display the menu again. This process is repeated until the user chooses to quit the program.

Would like to have all if-else statements in the loop to reiterate the options from prior to the first loop to input a new option

any suggestions or ideas would be appreciated
I am kind of new so any help in terms of posting would also be great
*/

#include <iostream>
#include <iomanip>
#include <cstdlib>

using namespace std;

int main()

{

char letter;
const int MINIMUM_VALUE = 0;
const int MAXIMUM_VALUE = 1000;
int Number_Generated;
int Number_Generated2;

cout << "Welcome User" << endl;
cout << "This program will allow you to become more familiar with the \n";
cout << "the basic mathematical operations, those operations being: \n" << endl;

cout << "Addition, Subtraction, Multiplication, Division. " <<endl << endl;


cout << "Input 'A' or 'a' for a Addition equation." << endl;
cout << "Input 'S' or 's' for a Subtraction equation." << endl;
cout << "Input 'M' or 'm' for a Multiplication." << endl;
cout << "Input 'D' or 'd' for a Division equation." << endl;
cout << "Input 'E' or 'e' to Exit" << endl << endl;

cout << "Answer: ";
cin >> letter;
cout << endl;

while (letter != 'E' && 'e' != letter)
{


if (letter == 'A' || 'a' == letter)
{
Number_Generated = (rand() % (MAXIMUM_VALUE - MINIMUM_VALUE +1)) +MINIMUM_VALUE;
Number_Generated2 = (rand() % (MAXIMUM_VALUE - MINIMUM_VALUE +1)) +MINIMUM_VALUE;

cout << Number_Generated << " + " << Number_Generated2 << " = " << endl;
cout << "Press any key to continue ...";
cin.get();

cout << endl;
cout << (Number_Generated + Number_Generated2) << endl;

cout << "For a different Equation please type in a new letter:";
cin >> letter;
}
else if (letter == 'S'||'s' == letter)
{
Number_Generated = (rand() % (MAXIMUM_VALUE - MINIMUM_VALUE +1)) +MINIMUM_VALUE;
Number_Generated2 = (rand() % (MAXIMUM_VALUE - MINIMUM_VALUE +1)) +MINIMUM_VALUE;

cout << Number_Generated << " - " << Number_Generated2 << " = " << endl;
cout << "Press any key to continue ...";
cin.get();

cout << endl;
cout << (Number_Generated - Number_Generated2) << endl;

cout << "For a different Equation please type in a new letter:";
cin >> letter;
}
else if (letter == 'M' || 'm' == letter)
{
Number_Generated = (rand() % (MAXIMUM_VALUE - MINIMUM_VALUE +1)) +MINIMUM_VALUE;
Number_Generated2 = (rand() % (MAXIMUM_VALUE - MINIMUM_VALUE +1)) +MINIMUM_VALUE;

cout << Number_Generated << " * " << Number_Generated2 << " = " << endl;
cout << "Press any key to continue ...";
cin.get();

cout << endl;
cout << (Number_Generated * Number_Generated2) << endl;

cout << "For a different Equation please type in a new letter:";
cin >> letter;
}
else if (letter == 'D' || 'd' == letter)
{
Number_Generated = (rand() % (MAXIMUM_VALUE - MINIMUM_VALUE +1)) +MINIMUM_VALUE;
Number_Generated2 = (rand() % (MAXIMUM_VALUE - MINIMUM_VALUE +1)) +MINIMUM_VALUE;

cout << Number_Generated << " / " << Number_Generated2 << " = " << endl;
cout << "Press any key to continue ...";
cin.get();

cout << endl;
cout << (Number_Generated / Number_Generated2) << endl;

cout << "For a different Equation please type in a new letter:";
cin >> letter;
}
else

cout << "Invalid entry, please try again: \n";
cin >> letter;
}

cout << "Okay then, Goodbye now. " << endl;

return 0;


}
Last edited on
# include <iostream>
# include <string>

using namespace std;
struct grade {
string Name;
float grade1, grade2;
string lGrade2;
}
st[3]
grade string grade clc(grade Book st)
{
float avg;
avg=(st. grade1 + st grade2)/2;
if (avg>50){
st.lGrade="Pass";
}
else {
st lGrade="fail";
}
return st lGrade;
{
void printmsg(grade Book st, string F)
cout<<st.Name<<"|t|t"<<st.grade1<<"|t|t"
<<st.grade<<"|t|t"<<F<<endl;
}
int main()}
for(int i=0, i<3, i++);
cout<<"Enter name of student "<<i+1;
cin>>>st[i].sName;
cout<<"Enter grades of students"i+1;
cin>>st[i] grade;
cout<<endl
cin>>st[i].grade2;
{

cout<<"student|t|t Grade_1|t|t Grade.2|t|t status\n";
for int i=0; i<3, i++;
{
printmsg(st[i] grade clc (st [i]);
}
}
i need some help with code, i keep on getting one error that says expected initializer at string
Topic archived. No new replies allowed.