how to generate random numbers between a and b?
is there any in-built function?
mathmagic
0
Newbie Poster
Recommended Answers
Jump to PostC++ offers the
rand()
function to generate pseudo-random numbers.
Here's a quick and dirty example using rand.#include<iostream> int main(int argc,char** argv) { int lowBound = 0; int upBound = 0; int random = 0; //Get lower bound (a) std::cout << "Input lower bound: "; std::cin …
All 4 Replies
BlackJavaBean
3
Light Poster
mathmagic
0
Newbie Poster
vijayan121
1,152
Posting Virtuoso
BlackJavaBean
3
Light Poster
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.