Name | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |Total
---------------------------------------------------------
Jenny | | | | | | | | | | |
| | | | | | | | | | |
---------------------------------------------------------
John | | | | | | | | | | |
| | | | | | | | | | |
--------------------------------------------------------- |
So, I have to make a simulated game of bowling that takes the number of players and their names and creates the scoreboard above. The "bowls" are generated in the program using rand() so I am pretty good with that aspect. I created a string array[max of 5 players] that used an int input of how many players will be playing so it only asks for the names of those playing even though it has a size of 5 strings. I have created the top two lines without a problem using two 1-D char arrays:
char line_one[79]= {'N', 'a','m','e',' ',' // ... etc.
char line_dashed[79];
for(int i=0;i<78;i++) {
line_dashed[i]='-';
}
cout << line_one << endl;
cout << line_dashed << endl;
which outputs:
Name | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |Total
--------------------------------------------------------
I need help with converting the names from the string array into a char array so that the scoreboard can print their names since I don't know how many chars their names will contain because the program asks for their names at the beginning of the program and every user will have a different name. I will also need to input the "amount of pins knocked down" into these arrays as the user bowls (by hitting enter or something) if that makes a difference. I don't think 2-D arrays are needed in this assignment since 1-D arrays are the focus of this assignment. Please help me out with this one if you can, thank you in advance!