I'm having trouble with this program that is a math tutor for a young student. The program should display two random numbers between 1 and 500. Could I get some help?
buddyrocks73
0
Newbie Poster
Recommended Answers
Jump to PostWhat have you tried so far?
Jump to Postrand() returns a value between 0 and RAND_MAX.
You need to apply some math to bound that value. In C++, the remainder operator is %.
int value = (rand() % 499) +1;
…
Jump to Post…rand() returns a value between 0 and RAND_MAX.
You need to apply some math to bound that value. In C++, the remainder operator is %.
int value = (rand() % 499) +1;
Jump to Post…rand() returns a value between 0 and RAND_MAX.
You need to apply some math to bound that value. In C++, the remainder operator is %.
int value = (rand() % 499) +1;
All 16 Replies
Narue
5,707
Bad Cop
Team Colleague
buddyrocks73
0
Newbie Poster
Duoas
1,025
Postaholic
Featured Poster
ithelp
757
Posting Virtuoso
Banned
invisal
381
Search and Destroy
Nick Evan
commented:
good catch
+3
Nick Evan
4,005
Industrious Poster
Team Colleague
Featured Poster
Narue
5,707
Bad Cop
Team Colleague
iamthwee
Narue
5,707
Bad Cop
Team Colleague
Nick Evan
4,005
Industrious Poster
Team Colleague
Featured Poster
iamthwee
Duoas
1,025
Postaholic
Featured Poster
Roebuc
0
Junior Poster
Narue
5,707
Bad Cop
Team Colleague
Roebuc
0
Junior Poster
Narue
5,707
Bad Cop
Team Colleague
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.