广东·自考在线欢迎各位自考生,今天是
您当前所在位置: 首页>串讲笔记>公共课

自考《高级语言程序设计》上机实践总结 

日期:2020-10-23 11:42:01  编辑整理:自考在线  【 】 【打印

高级语言上机图形输出题型考试的概率太大了/为了大家更好地学习特总结了一下/下面是一道2006年9月18上午考试题/要求输出图形为下图/输入数<20正整数(如输入3 ,输出下图)

B

B B B

B B B B B

程序如下:

main()
{int n,i,j;
printf( "please input 0 scanf( "%d",&n);
printf( " ");
if(n <=0||n>=20)
printf( "Error! n must be 0 else for(i=1;i <=n;i++)
{for(j=0;j for(j=1;j <=2*i-1;j++) printf("%c",'B');
printf( " ");
}
}

只要大家记住这个例子/可以说高级语言图形输出没有问题了/下面是拓展的几个类型/

约定:蓝色为修改地方

都以输入3输出下列图形

输入数为<20正整数

程序全部上机测试过

拓展1:

如输出

1

2 2 2

3 3 3 3 3

main()
{int n,i,j;
printf( "please input 0 scanf( "%d",&n);
printf( " ");
if(n <=0||n>=20)
printf( "Error! n must be 0 else for(i=1;i <=n;i++)
{for(j=0;j for(j=1;j <=2*i-1;j++) printf("%d",i);
printf( " ");
}
}

拓展2:

如输出

A

B B B

C C C C C


main()
{int n,i,j;
printf( "please input 0 scanf( "%d",&n);
printf( " ");
if(n <=0||n>=20)
printf( "Error! n must be 0 else for(i=1;i <=n;i++)
{for(j=0;j for(j=1;j <=2*i-1;j++) printf("%c",'A'+i-1);
printf( " ");
}
}

拓展3:

如输出

A

B B B

C C C C C


main()
{int n,i,j;
printf( "please input 0 scanf( "%d",&n);
printf( " ");
if(n <=0||n>=20)
printf( "Error! n must be 0 else for(i=1;i <=n;i++)
{/*for(j=0;j for(j=1;j <=2*i-1;j++) printf("%c",'A'+i-1);
printf( " ");
}
}

拓展4:

如输出

C C C C C

B B B

A

main()
{int n,i,j;
printf( "please input 0 scanf( "%d",&n);
printf( " ");
if(n <=0||n>=20)
printf( "Error! n must be 0 else for(i=n;i >0;i--)
{for(j=0;j for(j=1;j <=2*i-1;j++) printf("%c",'A'+i-1);
printf( " ");
}
}

拓展5:

如输出

1

2 2 2

3 3 3 3 3

2 2 2

1

main()
{int n,m,i,j;
printf( "please input 0 scanf( "%d",&n);
printf( " ");
if(n <=0||n>=20)
printf( "Error! n must be 0 else
{m=n;
for(i=1;i <=m;i++)
{for(j=0;j for(j=1;j <=2*i-1;j++) printf("%d",i);
printf( " ");
}
for(i=n-1;i >0;i--)
{for(j=0;j for(j=1;j <=2*i-1;j++) printf("%d",i);
printf( " ");
}
}
}

拓展6:

如输出

1
2 2 2
3 3 3 3 3
2 2 2
1

main()
{int n,m,i,j;
printf( "please input 0 scanf( "%d",&n);
printf( " ");
if(n <=0||n>=20)
printf( "Error! n must be 0 else
{m=n;
for(i=1;i <=m;i++)
{/*for(j=0;j for(j=1;j <=2*i-1;j++) printf("%d ",i);
printf( " ");
}
for(i=n-1;i >0;i--)
{/*for(j=0;j for(j=1;j <=2*i-1;j++) printf("%d ",i);
printf( " ");
}
}
}

拓展7:

如输出

B B B

B B B

B B B

main()
{int n,i,j;
printf( "please input 0 scanf( "%d",&n);
printf( " ");
if(n <=0||n>=20)
printf( "Error! n must be 0 else for(i=n;i >0;i--)
{for(j=0;j for(j=0;j printf( " ");
}
}

拓展8:

如输出

3 3 3

2 2 2

1 1 1

main()
{int n,i,j;
printf( "please input 0 scanf( "%d",&n);
printf( " ");
if(n <=0||n>=20)
printf( "Error! n must be 0 else for(i=n;i >0;i--)
{for(j=0;j for(j=0;j printf( " ");
}
}



自考助学服务中心微信公众号

热点关注:

广东省2002年7月高等教育自学考试高等数学(二)

全国2020年8月自考03708 中国近现代史纲要简答题

广东省2021年1月高等教育自学考试报考常见问答

全国2017年4月自考公司法试题

2021年广东自考英语翻译及写作的高分技巧

声明:
(一)由于考试政策等各方面情况的不断调整与变化,本网站所提供的考试信息仅供参考,请以权威部门公布的正式信息为准。
(二)本网站在文章内容来源出处标注为其他平台的稿件均为转载稿,免费转载出于非商业性学习目的,版权归原作者所有。如您对内容、版权等问题存在异议请与本站联系,我们会及时进行处理解决。
标签:

相关推荐

2020年广东自学考试日历

距2020年4月自考【报名】还有:

距2020年4月自考【考试】还有:

1 4 7 10
  • 新生预报名时间:8月下旬
  • 打印准考证时间:考前十天开始打印
  • 考试时间:2020年10月17日-18日
  • 成绩查询时间:考后一个月可以查询

广东自考交流群
交流答疑解惑

扫码进群
推荐院校

  • 推荐专业:{pboot:about scode=0 num=10}[about:title len=20]{/pboot:about}

  • 推荐专业:{pboot:about scode=0 num=10}[about:title len=20]{/pboot:about}

  • 推荐专业:{pboot:about scode=0 num=10}[about:title len=20]{/pboot:about}

  • 推荐专业:{pboot:about scode=0 num=10}[about:title len=20]{/pboot:about}

  • 推荐专业:{pboot:about scode=0 num=10}[about:title len=20]{/pboot:about}

  • 推荐专业:{pboot:about scode=0 num=10}[about:title len=20]{/pboot:about}