Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <iomanip>
  4. using namespace std;
  5.  
  6. void welcome_display();
  7. void game();
  8. int get_num_player();
  9. void get_players_name(string name[], int num_player);
  10. string get_name(int);
  11. bool play_again();
  12. void goodbye_display();
  13.  
  14. int main() {
  15. bool again;
  16.  
  17. welcome_display();
  18.  
  19. do {
  20. game();
  21. again = play_again();
  22. } while (again);
  23.  
  24. goodbye_display();
  25.  
  26. return 0;
  27. }
  28.  
  29. void welcome_display() {
  30. cout << "Welcome to Husin\'s Bowling\n";
  31. system("pause");
  32. system("cls");
  33. }
  34.  
  35. void game() {
  36. int num_player;
  37.  
  38. num_player = get_num_player();
  39.  
  40. string name[num_player];
  41. int pin[num_player][9][2], last_shot[num_player][3];
  42.  
  43. get_players_name(name, num_player);
  44.  
  45. for (int i = 0; i < num_player; i++) {
  46. cout << name[i] << endl;
  47. }
  48.  
  49. }
  50.  
  51. int get_num_player() {
  52. int num_player;
  53.  
  54. do {
  55. cout << "Enter the number of player(s) (1-5): ";
  56. cin >> num_player;
  57.  
  58. if (num_player < 1 || num_player > 5) {
  59. cout << "Invalid Input!!\n";
  60. }
  61. } while (num_player < 1 || num_player > 5);
  62.  
  63. system("cls");
  64. return num_player;
  65. }
  66.  
  67. void get_players_name(string name[], int num_player) {
  68. for (int i = 0; i < num_player; i++) {
  69. name[i] = get_name(i);
  70. }
  71. system("cls");
  72. }
  73.  
  74. string get_name(int count) {
  75. string name;
  76.  
  77. cout << "Enter nickname for player #" << count + 1 << ": ";
  78. cin >> name;
  79.  
  80. return name;
  81. }
  82.  
  83. bool play_again() {
  84.  
  85. }
  86.  
  87. void goodbye_display() {
  88.  
  89. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement