L1-7 谁是赢家

思路

这题就是读入打印

代码

#include <bits/stdc++.h>
using namespace std;

char g[105][105];

int main()
{
    char ch;
    int n;
    scanf("%c%d",&ch,&n);
    getchar();
    n--;
    for (int i=0;i<=n;i++) {
        fgets(g[i],105,stdin);
    }
    bool flag=true;
    for (int i=0;i<=n/2;i++) {
        for (int j=0;j<n;j++) {
            if (g[i][j]!=g[n-i][j]) {
                flag=false;
                goto outloop;
            }
        }
    }
    outloop:
    if (flag) {
        printf("bu yong dao le\n");
    }
    for (int i=n;i>=0;i--) {
        for (int j=n;j>=0;j--) {
            if (g[i][j]==' ') {
                printf(" ");
            }
            else {
                printf("%c",ch);
            }
        }
        printf("\n");
    }
    return 0;
}

猜你喜欢

转载自www.cnblogs.com/xyqxyq/p/12336708.html