Click here to Skip to main content
15,899,314 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Some help please Pin
PJ Arends13-Dec-04 7:00
professionalPJ Arends13-Dec-04 7:00 
GeneralRe: Some help please Pin
Tom Wright13-Dec-04 9:36
Tom Wright13-Dec-04 9:36 
GeneralRe: Some help please Pin
toxcct13-Dec-04 7:50
toxcct13-Dec-04 7:50 
GeneralCSpinButtonCtrl object Pin
poornimac8013-Dec-04 5:05
poornimac8013-Dec-04 5:05 
Generalhelp on timeSetEvent for periodic timer Pin
bkhn4113-Dec-04 4:46
bkhn4113-Dec-04 4:46 
GeneralSATO printer programming Pin
Blubbo13-Dec-04 4:40
Blubbo13-Dec-04 4:40 
GeneralPainting text problem Pin
__makaveli__13-Dec-04 4:30
__makaveli__13-Dec-04 4:30 
GeneralHelppp cant figure this out Pin
James198513-Dec-04 3:24
James198513-Dec-04 3:24 
OK guys well im sorta finished with my final project but i cant get it to work CORRECTLY. The program is to have a menu and ask the user to choose betweetn add, subtract, mult and divide. when they choose whatever one it will ask them a simple question. and if they get the correct answer or wrong answer it will ask them again if they want another problem. If they choose yes then it will give em another problem but if they choose no it will go back to the menu. I cant seem when they enter no it keeps say "enter another seed vaule" I want it to go back to the menu. Well here is the code. O and if they enter anything besides Y or N i need it to say sorry that is an incorrect choice. Here is the code:

#include
#include
#include
using namespace std;

int main()
{
int choice; float num1, num2, answer, correct;
char again;
unsigned seed;
do
{
cout << "\n\t\tSimple Math Tutor Menu\n\n";
cout << "1. Addition\n";
cout << "2. Subtraction\n";
cout << "3. Division\n";
cout << "4. Multiplication\n";
cout << "5. Quit The Program\n\n";
cout << "Please enter a choice: ";
cin >> choice;
if (choice <1 || choice >5)
{
cout << "Sorry that is an incorrect choice!"<<endl;
cout <<="" "please="" enter="" another="" choice="" "<<endl;
cin="">> choice;
}
cout<<"Enter a seed value: ";
cin>>seed;
srand(seed);
num1 = 1 + rand() % 10;
num2 = 1 + rand() % 10;


switch (choice)
{

case 1 : do
{

cout << "What is the sum of "<< num1 << " and " << num2 <<endl;
cin>> answer;
correct = num1 + num2;
if ( answer == correct)
{
cout << "Congratulations you are correct!" <<endl;
}
else
{
cout="" <<="" "sorry="" that="" was="" incorrect"="" <<endl;
cout="" "the="" correct="" answer="" was:="" "="" <<endl;

}
cout="" "would="" you="" like="" to="" do="" another="" problem="" (y="" n)?="" ";
cin="">> again;
cout<<"\nEnter another seed value: ";
cin>>seed;
num1 = 1 + rand() % 10;
num2 = 1 + rand() % 10;
}while (again=='y' || again=='Y');
if (again != 'y' || again !='Y')
cout << "Sorry That is an incorrect choice" <
GeneralRe: Helppp cant figure this out Pin
jmkhael13-Dec-04 3:53
jmkhael13-Dec-04 3:53 
GeneralRe: Helppp cant figure this out Pin
toxcct13-Dec-04 7:56
toxcct13-Dec-04 7:56 
QuestionHow to pop system menu in an owner-draw dialog Pin
max_xiayi13-Dec-04 3:01
max_xiayi13-Dec-04 3:01 
GeneralDCOM Question Pin
Anonymous13-Dec-04 3:00
Anonymous13-Dec-04 3:00 
Questionhow to convert string to binary Pin
Abhi Lahare13-Dec-04 1:45
Abhi Lahare13-Dec-04 1:45 
AnswerRe: how to convert string to binary Pin
valikac13-Dec-04 4:57
valikac13-Dec-04 4:57 
Generaltooltips for controls inside groupbox Pin
V.13-Dec-04 0:49
professionalV.13-Dec-04 0:49 
GeneralRe: tooltips for controls inside groupbox Pin
PJ Arends13-Dec-04 7:11
professionalPJ Arends13-Dec-04 7:11 
GeneralRe: tooltips for controls inside groupbox Pin
V.13-Dec-04 7:24
professionalV.13-Dec-04 7:24 
GeneralRe: tooltips for controls inside groupbox Pin
PJ Arends13-Dec-04 7:50
professionalPJ Arends13-Dec-04 7:50 
GeneralRe: tooltips for controls inside groupbox Pin
V.13-Dec-04 8:58
professionalV.13-Dec-04 8:58 
GeneralRe: tooltips for controls inside groupbox Pin
toxcct13-Dec-04 8:02
toxcct13-Dec-04 8:02 
GeneralRe: tooltips for controls inside groupbox Pin
V.13-Dec-04 8:55
professionalV.13-Dec-04 8:55 
QuestionCool tools? Pin
ManOfTheYear13-Dec-04 0:37
ManOfTheYear13-Dec-04 0:37 
AnswerRe: Cool tools? Pin
ThatsAlok13-Dec-04 1:04
ThatsAlok13-Dec-04 1:04 
AnswerRe: Cool tools? Pin
13-Dec-04 1:04
suss13-Dec-04 1:04 
AnswerRe: Cool tools? Pin
Anonymous13-Dec-04 11:32
Anonymous13-Dec-04 11:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.