Lachrymose
smokeMeth();
Hey guys, I need some help with random numbers and words.
I am trying to make a random motion formula problem for physics class.
[highlight=cpp] double gravity = 9.81;
double mass = rand() % 100;
double acc = rand() % 100;
double fg = gravity * mass;
double fnet = mass * acc;
srand(time(0));
cout << "A car accelerates at " << acc << "mps and has mass is " <<mass<< "kg. Find fnet and fg" <<endl;[/highlight]
I have no idea where to start for the random words. But I want it to be like "car, bike, train, etc". And for the numbers, I can't get them to go random. They turn out to be 67 and 41. I can use the rand() function alone but then the numbers are too high. Thanks in advance.
I am trying to make a random motion formula problem for physics class.
[highlight=cpp] double gravity = 9.81;
double mass = rand() % 100;
double acc = rand() % 100;
double fg = gravity * mass;
double fnet = mass * acc;
srand(time(0));
cout << "A car accelerates at " << acc << "mps and has mass is " <<mass<< "kg. Find fnet and fg" <<endl;[/highlight]
I have no idea where to start for the random words. But I want it to be like "car, bike, train, etc". And for the numbers, I can't get them to go random. They turn out to be 67 and 41. I can use the rand() function alone but then the numbers are too high. Thanks in advance.