Hey everyone
just to refresh my memory and practice some programming I decided to make the dice program
here is my code:
#include <iostream>
#include <ctime>
using namespace std;
int main()
{
int input;
int random;
cout << " VIRTUAL DICE 1.0" << endl;
cout << "Enter 1 to roll and 0 to quit: ";
cin >> input;
switch(random)
{
srand((unsigned)time(0));
for(int i = 0; i <= 6; i++)
{
random = rand();
cout << random << endl;
}
case 1:
cout << "--------" << endl;
cout << "| |" << endl;
cout << "| O |" << endl;
cout << "| |" << endl;
cout << "--------" << endl;
case 2:
cout << "--------" << endl;
cout << "|O |" << endl;
cout << "| |" << endl;
cout << "| O|" << endl;
cout << "--------" << endl;
case 3:
cout << "--------" << endl;
cout << "| O|" << endl;
cout << "| O |" << endl;
cout << "|O |" << endl;
cout << "--------" << endl;
case 4:
cout << "--------" << endl;
cout << "|O O|" << endl;
cout << "| |" << endl;
cout << "|O O|" << endl;
cout << "--------" << endl;
case 5:
cout << "--------" << endl;
cout << "|O O|" << endl;
cout << "| O |" << endl;
cout << "|O O|" << endl;
cout << "--------" << endl;
case 6:
cout << "--------" << endl;
cout << "|O O|" << endl;
cout << "|O O|" << endl;
cout << "|O O|" << endl;
cout << "--------" << endl;
}
system("PAUSE");
return 0;
}
now this doesnt really work the way I want it to, the user inputs the number 1 and it will randomly show one dice on the screen but it breaks. I am missin the part if the user enter 0, I will do it after I figure this out.... also is there like a much better way to do this instead of doing it like this cause I would like to learn that.