0
C++ I need to change an array that has rows and columns to "*"
If I have an array with 3 rows and 3 columns (the rows are numbers and the columns are letters)and I want to ask the user to input the row and column then change that '*'.
3 odpowiedzi
+ 1
int col;
char charCol;
//####################################
// your code to get the row goes here'
//####################################
puts("Enter column a, b or c?");
switch(tolower(charCol = getchar())){
case 'a':
col = 0;
break;
case 'b':
col = 1;
break;
case 'c':
col = 2;
}
myarr[row][col] = '*'; //< example only. Bounds checking is up to you.
0
The question is unclear
0
Thanks. Both were helpful and I was able to figure it out.