2019春季学期第三周编程总结


实验代码:

#include <stdio.h>
#define  a 10
int main() 
{
    int T,n,i,h,l,j,p;
    int sz[a][a];
    scanf("%d",&T);
    for(i=1;i<=T;i++)
    {
        scanf("%d",&n);


        for(h=0;h<=n-1;h++)
        {
            for(l=0;l<=n-1;l++)
                scanf("%d",&sz[h][l]);
        }
        j=0;
        p=1;
        for(h=1;h<=n-1;h++)
        {
            for(l=0;l<=j;l++)
            {
                if(sz[h][l]!=0)
                    p=0;
                p=p*1;
            }
            j++;
        }
        if(p==1)
            printf("YES
");
        if(p==0)
            printf("NO
");
        }

    return 0;
}

PS:此代码借鉴于: https://blog.csdn.net/qq_41219157/article/details/78825952 (因为想了很久没有头绪,便上网百度了一个代码。此代码在原代码基础上修改而写)

设计思路:

运行结果截图:

总结反思:本次作业做的比较差,因为是借鉴他人的代码,所以即使写对了,也丝毫没有成就感。接下来在数组学习的路上还有很长一段路要走,还要多多努力学习了。以后的作业也尽力完成,尽量少借鉴或不借鉴他人代码,争取做到原创。

原文地址:https://www.cnblogs.com/ImportantMagic/p/10538821.html