Advertisement
Guest User

Untitled

a guest
Aug 17th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. //main.cpp
  2. //0618-231 Technical Programming I Spring 2011
  3. //Michael Steenbeke Date: 05/11/11
  4. //Title:Prelab 10
  5. //Platform: C++ Win32 Console Visual Studio 2010
  6. #include <stdio.h>
  7. #include <iostream>
  8. #include <string>
  9. #include <iomanip>
  10. #include <ctime>
  11.  
  12. using namespace std;
  13.  
  14.  
  15. int main(int argc, char *args[]){
  16.  
  17. int flip0 = 0;
  18. int flip1 = 0;
  19. int flip2 = 0;
  20. int flip3 = 0;
  21. int flip4 = 0;
  22. int flip5 = 0;
  23. int flip[6];
  24. int selection = 0;
  25.  
  26. //while(!cin.eof())
  27. //{
  28. srand(time(NULL));
  29.  
  30. flip0 = rand() % 6 + 1;
  31. flip1 = rand() % 6 + 1;
  32. flip2 = rand() % 6 + 1;
  33. flip3 = rand() % 6 + 1;
  34. flip4 = rand() % 6 + 1;
  35. flip5 = rand() % 6 + 1;
  36.  
  37. cout << " Dice 1: "<< flip0 << endl;
  38. cout << " Dice 2: "<< flip1 << endl;
  39. cout << " Dice 3: "<< flip2 << endl;
  40. cout << " Dice 4: "<< flip3 << endl;
  41. cout << " Dice 5: "<< flip4 << endl;
  42. cout << " Dice 6: "<< flip5 << endl;
  43.  
  44. cout << "Please pick one die you would like rolled again: " << endl;
  45. cin >> selection;
  46.  
  47. if (selection == 1)
  48. {
  49. flip0 = rand() % 6 +1;
  50. cout << flip0;
  51. cout << flip1;
  52. cout << flip2;
  53. cout << flip3;
  54. cout << flip4;
  55. cout << flip5;
  56. }
  57. else if (selection == 2)
  58. {
  59. flip1 = rand() % 6 +1;
  60. cout << flip0;
  61. cout << flip1;
  62. cout << flip2;
  63. cout << flip3;
  64. cout << flip4;
  65. cout << flip5;
  66. }
  67. else if (selection == 3)
  68. {
  69. flip2 = rand() % 6 +1;
  70. cout << flip0;
  71. cout << flip1;
  72. cout << flip2;
  73. cout << flip3;
  74. cout << flip4;
  75. cout << flip5;
  76. }
  77. else if (selection == 4)
  78. {
  79. flip3 = rand() % 6 +1;
  80. cout << flip0;
  81. cout << flip1;
  82. cout << flip2;
  83. cout << flip3;
  84. cout << flip4;
  85. cout << flip5;
  86. }
  87. else if (selection == 5)
  88. {
  89. flip4 = rand() % 6 +1;
  90. cout << flip0;
  91. cout << flip1;
  92. cout << flip2;
  93. cout << flip3;
  94. cout << flip4;
  95. cout << flip5;
  96. }
  97. else if (selection == 6)
  98. {
  99. flip5 = rand() % 6 +1;
  100. cout << flip0;
  101. cout << flip1;
  102. cout << flip2;
  103. cout << flip3;
  104. cout << flip4;
  105. cout << flip5;
  106. }
  107.  
  108. //}
  109.  
  110.  
  111. cout << endl;
  112. system("pause");
  113. return 0;
  114.  
  115. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement