Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <iomanip>
- using namespace std;
- void welcome_display();
- void game();
- int get_num_player();
- void get_players_name(string name[], int num_player);
- string get_name(int);
- bool play_again();
- void goodbye_display();
- int main() {
- bool again;
- welcome_display();
- do {
- game();
- again = play_again();
- } while (again);
- goodbye_display();
- return 0;
- }
- void welcome_display() {
- cout << "Welcome to Husin\'s Bowling\n";
- system("pause");
- system("cls");
- }
- void game() {
- int num_player;
- num_player = get_num_player();
- string name[num_player];
- int pin[num_player][9][2], last_shot[num_player][3];
- get_players_name(name, num_player);
- for (int i = 0; i < num_player; i++) {
- cout << name[i] << endl;
- }
- }
- int get_num_player() {
- int num_player;
- do {
- cout << "Enter the number of player(s) (1-5): ";
- cin >> num_player;
- if (num_player < 1 || num_player > 5) {
- cout << "Invalid Input!!\n";
- }
- } while (num_player < 1 || num_player > 5);
- system("cls");
- return num_player;
- }
- void get_players_name(string name[], int num_player) {
- for (int i = 0; i < num_player; i++) {
- name[i] = get_name(i);
- }
- system("cls");
- }
- string get_name(int count) {
- string name;
- cout << "Enter nickname for player #" << count + 1 << ": ";
- cin >> name;
- return name;
- }
- bool play_again() {
- }
- void goodbye_display() {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement