当前所在位置:珠峰网资料 >> 计算机 >> 软件水平 >> 正文
2015年计算机软件水平程序员笔试考前练习精选(7)
发布时间:2012/11/4 15:13:21 来源:城市网学院 编辑:admin
   #include
    main()
    {
    static int a[5][5]={
    {1,2,3,4,0},
    {2,3,4,0,6},
    {3,0,1,7,5},
    {0,0,2,4,1},
    {8,4,3,2,7}
    };
    int i,j;
    for (i=0;i<5;i++)
    {
    for (j=0;j<5;j++)
    {
    if (a[j]==0)
    break;
    printf(“M”,a[j]);
    }
    printf(“\n”);
    }
    答案:
    1 2 3 4
    2 3 4
    3
    8 4 3 2 7
    个人解析下:
    首先我们从for (j=0;j<5;j++)看起,往下是
    {
    if (a[j]==0)
    break;
    printf(“M”,a[j]);
    }
    examda提示: 把a[5][5]二维数组中的每列中从左至右第一个为零的数之前的数输出!
    for (i=0;i<5;i++) 就是5行
广告合作:400-664-0084 全国热线:400-664-0084
Copyright 2010 - 2017 www.my8848.com 珠峰网 粤ICP备15066211号
珠峰网 版权所有 All Rights Reserved