• 大小: 2.95KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-02-01
  • 标签:

资源简介

C++实战源码-用星号打印图形(入门级实例069).zip

资源截图

代码片段和文件信息

// Parallelogram.cpp : Defines the entry point for the console application.
//

#include “stdafx.h“

int main()
{
char a[5] =
{
‘*‘ ‘*‘ ‘*‘ ‘*‘ ‘*‘
}; //定义字符型数组,五个元素初值均为‘*‘
int i j k;  //定义变量i,j,k为基本整型
for (i = 0; i < 5; i++) //输出5行
{
for (j = 1; j <= i; j++) //输出空格的数量随着行数的变化而变化
{
printf(“ “);
}
for (k = 0; k < 5; k++)
{
printf(“%c“ a[k]); //将a数组中的元素输出
}
printf(“\n“);  //每输出一行后换行
}
return 0;
}


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件         560  2010-09-08 09:49  Parallelogram\Parallelogram.cpp
     文件        4620  2010-09-08 09:38  Parallelogram\Parallelogram.dsp
     文件         551  2010-09-08 09:38  Parallelogram\Parallelogram.dsw
     文件         300  2010-09-08 09:38  Parallelogram\StdAfx.cpp
     文件         769  2010-09-08 09:38  Parallelogram\StdAfx.h

评论

共有 条评论