I'm writing a program for my assignment, and I wish to try out randomizing. I've one random test done a simple true false and its works well. My next question is. Would it be possible to have a set number of items that is inputted by the user and have each item randomly put into a weight category? Below is the code i've written, I have a little more to write out but that is easy stuff i can do on my own. its just the random question I would like help with.
int _tmain(int argc, _TCHAR* argv[])
{
// used variables
cout << "\n\n\t How many eggs was Brought in delivery?: ";
cin >> egg; // input for amount of eggs.
total = egg*0.02;
cout << "\n\n\t The basic entitlement for : " << egg << "eggs is: " << total << endl;
system("pause"); // pauses system before solmonella test
cout << "\n\n\t Solmonella test";
bool solmonellatester ();
{
srand((unsigned)time(0));
int i = rand() % 2;
if (i == 1)
{
cout << "\n\n\t Solmonella test returned positive, no payment destroy batch!";
}
else if (i == 0)
{
cout << "\n\n\t No solmonella detected in batch, please continue";
}
}
if (weight <53)
cout << "\n\n\t Grade A small eggs";
total= total_s*0.05;
else if (weight >=53)
cout << "\n\n\t Grade A Medium eggs";
total= total_m*0.06;
else if (weight >=63)
cout << "\n\n\t Grade A Large eggs";
total=total_l*0.07;
else if (weight >=73)
cout << "\n\n\t Grade A Xtra large Eggs";
total=total_xl*0.08;