i need any help for a project!


B

beg_c++

hi i am a beginner in c++, i have a project to be done by few weeks.
This project is a maths help for kids!! it is supposed to ask the kid
how many problems the kid want and then show the problems and then the
kid has to answer it and then the program says if is right or wrong!!

i have half done by my self!!! i cant figure out one thing!! how do i
do for the program give the exactly number of problems that the kid
asked for!!! i have got the idea for that i am basically sure it is a
loop but i cant set it up!! Can someone help me?

#include <cstdlib>
#include <iostream>

using namespace std;

int main()
{
int number, answer; //variables

cout<<"how many problems would like?"; //display the question
cin>>number;


srand(time(NULL));
int j=1+(int) (12.0*rand()/(RAND_MAX+1.0)); // generate first
random number
int j1=1+(int) (12.0*rand()/(RAND_MAX+1.0)); // generate second
random number

cout<<"Question 1: What is "<<j<<" x "<<j1<<"?";// first question
cin>>answer;

if (answer==j*j1) //anser correct or
wrong
cout<<"Correct!"<<endl;
else
cout<<"No,"<<j<<" x "<<j1<<" is: "<<j*j1<<endl;



system("PAUSE");
return EXIT_SUCCESS;
}
 
Ad

Advertisements

M

mlimber

beg_c++ said:
hi i am a beginner in c++, i have a project to be done by few weeks.
This project is a maths help for kids!! it is supposed to ask the kid
how many problems the kid want and then show the problems and then the
kid has to answer it and then the program says if is right or wrong!!

i have half done by my self!!! i cant figure out one thing!! how do i
do for the program give the exactly number of problems that the kid
asked for!!! i have got the idea for that i am basically sure it is a
loop but i cant set it up!! Can someone help me?

All those exclamation points make you seem hyperactive. Try to calm
yourself!!
#include <cstdlib>
#include <iostream>

using namespace std;

int main()
{
int number, answer; //variables

cout<<"how many problems would like?"; //display the question
cin>>number;


srand(time(NULL));
int j=1+(int) (12.0*rand()/(RAND_MAX+1.0)); // generate first
random number
int j1=1+(int) (12.0*rand()/(RAND_MAX+1.0)); // generate second
random number

for( int i=0; i < number; ++i )
{
cout<<"Question 1: What is "<<j<<" x "<<j1<<"?";// first question
cin>>answer;

if (answer==j*j1) //anser correct or
wrong
cout<<"Correct!"<<endl;
else
cout<<"No,"<<j<<" x "<<j1<<" is: "<<j*j1<<endl;

}
 
V

Victor Bazarov

mlimber said:
beg_c++ said:
hi i am a beginner in c++, i have a project to be done by few weeks.
This project is a maths help for kids!! [...]
[...]

I should be involving kids in my excuses for not doing my homework
more often... How effective this was, unbelievable!
 
K

Kevin Handy

Victor said:
mlimber said:
beg_c++ said:
hi i am a beginner in c++, i have a project to be done by few weeks.
This project is a maths help for kids!! [...]

[...]


I should be involving kids in my excuses for not doing my homework
more often... How effective this was, unbelievable!

You mean, you want to do it "for the children".
Isn't that one of those polotical "slogans" that
Clinton always went back to? I guess it worked
well for him, so why can't everyone else use it.
 
Ad

Advertisements

K

Kevin Handy

Victor said:
mlimber said:
beg_c++ said:
hi i am a beginner in c++, i have a project to be done by few weeks.
This project is a maths help for kids!! [...]

[...]


I should be involving kids in my excuses for not doing my homework
more often... How effective this was, unbelievable!

You mean, you want to do it "for the children".
Isn't that one of those polotical "slogans" that
Clinton always went back to? I guess it worked
well for him, so why can't everyone else use it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top