473,326 Members | 2,104 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

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 1484
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: sk | last post by:
I have an applicaton in which I collect data for different parameters for a set of devices. The data are entered into a single table, each set of name, value pairs time-stamped and associated with...
11
by: Mark | last post by:
Hi, For the last 2 years I've been developing vehicle tracking/telemetric software for a company as a self employed individual. The project is quiet big, and is going to be there flagship...
10
by: Tom | last post by:
I am looking for some ideas for how to design the layout of the form for data entry and to display the data for the following situation: There are many sales associates. A sales associate can work...
48
by: Chad Z. Hower aka Kudzu | last post by:
A few of you may recognize me from the recent posts I have made about Indy <http://www.indyproject.org/indy.html> Those of you coming to .net from the Delphi world know truly how unique and...
1
by: steve | last post by:
oh the powers that be! my boss wanted me to include several .net project that i have created to a cvs repository that is unix based. he walked me through a client application called "eclipse"...
12
by: Noel | last post by:
Hello, I'm currently developing a web service that retrieves data from an employee table. I would like to send and retrieve a custom employee class to/from the webservice. I have currently coded...
17
by: Student | last post by:
Hi All, I have an assignment for my Programming language project to create a compiler that takes a C++ file as input and translate it into the C file. Here I have to take care of inheritance and...
15
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to...
0
by: garimaarora | last post by:
hi i am a beginner of c++ language and had tried to build a project in c++ language the project is throwing me set of exceptions and i need ur help if there is anybody who is interested in...
3
by: shapper | last post by:
Hello, I am working on an ASP.MET MVC Web Application with NET 3.5 in VS 2008. I need to run some extra tasks on this project build so I download MSBuild from http://msbuildtasks.tigris.org/....
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.