Advertisement
Th3Tom

dice_cpp

Dec 6th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #include "time.h"
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. void main()
  6. {
  7. int input, num;
  8.  
  9. srand(time(NULL));
  10.  
  11. do {
  12.  
  13. system("cls");
  14.  
  15. cout << " +--------------------+" << endl;
  16. cout << " | What dice |" << endl;
  17. cout << " +--------------------+" << endl;
  18. cout << " | 1 - d6 |" << endl;
  19. cout << " | 2 - d20 |" << endl;
  20. cout << " +--------------------+" << endl << endl;;
  21. cout << " ";
  22.  
  23. cin >> input;
  24.  
  25. switch (input) {
  26. case 1:
  27. num = rand() % 6 + 1;
  28. break;
  29.  
  30. case 2:
  31. num = rand() % 20 + 1;
  32. break;
  33. }
  34.  
  35. cout << endl << " " << num << endl << endl << " ";
  36.  
  37. system("pause");
  38. } while (1);
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement