\(P1101\)
key emphasis!
\ (scanf ( "\% c ", a) \) will read the line breaks! ! ! ! ! ! ! ! ! ! !
Do pay attention to it! ! ! ! ! ! ! !
for(int i=1;i<=n;i++){
for(int j=1;j<=n+1;j++){
scanf("%c",&mapp[i][j]);
}
}
The \ (n + 1 \) is a pit! ! ! !
Half of the code
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
char mapp[105][105];
int n;
bool ifzhong(char s){
return (s=='y'||s=='i'||s=='z'||s=='h'||s=='o'||s=='n'||s=='g');
}
int main( ){
// memset(mapp,0,sizeof(mapp));
scanf("%d\n",&n);
for(int i=1;i<=n;i++){
for(int j=1;j<=n+1;j++){
scanf("%c",&mapp[i][j]);
}
}
for(int i=1;i<=n;i++){
for(int j=1;j<=n+1;j++){
if(!ifzhong(mapp[i][j])){
mapp[i][j]='*';
}
}
}
for(int i=1;i<=n;i++){
for(int j=1;j<=n+1;j++){
if(j!=n+1){
printf("%c",mapp[i][j]);
}
}
printf("\n");
}
return 0;
}