#2019120500004-LG 单词方阵
\(P1101\)
重点强调!
\(scanf("\%c",a)\)会读入换行符!!!!!!!!!!!
千万要注意啦!!!!!!!!
for(int i=1;i<=n;i++){
for(int j=1;j<=n+1;j++){
scanf("%c",&mapp[i][j]);
}
}
这个\(n+1\)很坑!!!!
一半的代码
#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;
}
要做就做南波万