Lee_assig20 - cin>>d if (d==c)...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 //cheu Lee Assignment#20 #include<iostream> #include<ctime> #include<cmath> using namespace std void function(void) int main() { int a=0 while (a!=2){ cout<<"+++++++++++++++++++++++++++++++++++++"<<endl cout<<"Choose one of the following:"<<endl cout<<" 1. Practice on multiplication"<<endl cout<<" 2. Quit"<<endl cout<<"++++++++++++++++++++++++++++++++++++++"<<endl cin>>a if (a==1){ function() } else { cout<<"This program is terminated"<<endl } } return 0 } void function(void){ int a, b, c, d srand(time(0)) a=rand()%100 b=rand()%100 c=a*b cout<<c<<endl cout<<"What is: "<<a<<" * "<<b<<" = ?"<<endl
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: cin>>d if (d==c) cout<<"Great, your answer is correct!"<<endl else{ cout<<"Sorry, your answer is incorrect."<<endl cout<<"What is: "<<a<<" * "<<b<<" = ?"<<endl cin>>d if (d==c) cout<<"Great, your answer is correct!"<<endl else{ cout<<"Sorry, your answer is incorrect."<<endl cout<<"What is: "<<a<<" * "<<b<<" = ?"<<endl cin>>d if (d==c) cout<<"Great, your answer is correct!"<<endl else{ cout<<"Sorry, your answer is incorrect."<<endl cout<<"The correct answer is: "<<c<<endl } Sheet1 Page 2 } } }...
View Full Document

This note was uploaded on 05/16/2010 for the course CISCO EST61 taught by Professor Miller during the Spring '10 term at Fresno City College.

Page1 / 2

Lee_assig20 - cin>>d if (d==c)...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online