truviet911
10-22-2009, 06:02 AM
i need some help with how to short numbers in to range. examples
00-09: *
10-19: **
20-29: ***
30-39: ****
40-49: *****
50-59: ****
60-69: ***
70-79: **
80-89: *
90-99: *
ex: range 10-19 it has number 15, 17 in it therefore it has 2 asterisks. here is my random number code:
#include <cstdlib>
#include <ctime>
#include <iostream>
using namespace std;
int main()
{
srand((unsigned)time(0));
int random_integer;
for(int index=0; index<50; index++){
random_integer = (rand()%50)+10;
cout << random_integer << endl;
}
system("pause");
}
00-09: *
10-19: **
20-29: ***
30-39: ****
40-49: *****
50-59: ****
60-69: ***
70-79: **
80-89: *
90-99: *
ex: range 10-19 it has number 15, 17 in it therefore it has 2 asterisks. here is my random number code:
#include <cstdlib>
#include <ctime>
#include <iostream>
using namespace std;
int main()
{
srand((unsigned)time(0));
int random_integer;
for(int index=0; index<50; index++){
random_integer = (rand()%50)+10;
cout << random_integer << endl;
}
system("pause");
}