Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //main.cpp
- //0618-231 Technical Programming I Spring 2011
- //Michael Steenbeke Date: 05/11/11
- //Title:Prelab 10
- //Platform: C++ Win32 Console Visual Studio 2010
- #include <stdio.h>
- #include <iostream>
- #include <string>
- #include <iomanip>
- #include <ctime>
- using namespace std;
- int main(int argc, char *args[]){
- int flip0 = 0;
- int flip1 = 0;
- int flip2 = 0;
- int flip3 = 0;
- int flip4 = 0;
- int flip5 = 0;
- int flip[6];
- int selection = 0;
- //while(!cin.eof())
- //{
- srand(time(NULL));
- flip0 = rand() % 6 + 1;
- flip1 = rand() % 6 + 1;
- flip2 = rand() % 6 + 1;
- flip3 = rand() % 6 + 1;
- flip4 = rand() % 6 + 1;
- flip5 = rand() % 6 + 1;
- cout << " Dice 1: "<< flip0 << endl;
- cout << " Dice 2: "<< flip1 << endl;
- cout << " Dice 3: "<< flip2 << endl;
- cout << " Dice 4: "<< flip3 << endl;
- cout << " Dice 5: "<< flip4 << endl;
- cout << " Dice 6: "<< flip5 << endl;
- cout << "Please pick one die you would like rolled again: " << endl;
- cin >> selection;
- if (selection == 1)
- {
- flip0 = rand() % 6 +1;
- cout << flip0;
- cout << flip1;
- cout << flip2;
- cout << flip3;
- cout << flip4;
- cout << flip5;
- }
- else if (selection == 2)
- {
- flip1 = rand() % 6 +1;
- cout << flip0;
- cout << flip1;
- cout << flip2;
- cout << flip3;
- cout << flip4;
- cout << flip5;
- }
- else if (selection == 3)
- {
- flip2 = rand() % 6 +1;
- cout << flip0;
- cout << flip1;
- cout << flip2;
- cout << flip3;
- cout << flip4;
- cout << flip5;
- }
- else if (selection == 4)
- {
- flip3 = rand() % 6 +1;
- cout << flip0;
- cout << flip1;
- cout << flip2;
- cout << flip3;
- cout << flip4;
- cout << flip5;
- }
- else if (selection == 5)
- {
- flip4 = rand() % 6 +1;
- cout << flip0;
- cout << flip1;
- cout << flip2;
- cout << flip3;
- cout << flip4;
- cout << flip5;
- }
- else if (selection == 6)
- {
- flip5 = rand() % 6 +1;
- cout << flip0;
- cout << flip1;
- cout << flip2;
- cout << flip3;
- cout << flip4;
- cout << flip5;
- }
- //}
- cout << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement