470,862 Members | 1,809 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,862 developers. It's quick & easy.

i need any help for a project!

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;
}

May 11 '06 #1
4 1391
beg_c++ wrote:
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;
}

system("PAUSE");
return EXIT_SUCCESS;
}


May 11 '06 #2
mlimber wrote:
beg_c++ wrote:
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!
May 11 '06 #3
Victor Bazarov wrote:
mlimber wrote:
beg_c++ wrote:
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.

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
May 11 '06 #4
Victor Bazarov wrote:
mlimber wrote:
beg_c++ wrote:
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.

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
May 11 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

48 posts views Thread by Chad Z. Hower aka Kudzu | last post: by
1 post views Thread by steve | last post: by
reply views Thread by garimaarora | last post: by
3 posts views Thread by shapper | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.