#include<iostream>
using namespace std;
//打印书本上的图案
int main()
{
//用字符数组方法
/*char a[5] = { '*','*','*','*','*' };
for (int i = 0; i < 5; i++)
{
for (int j = 0; j < i ; j++)
cout << " ";
for (int k = 0; k < 5; k++)
cout << a[k];
cout << endl;
}*/
//用string方法
string stars = "*****";
for (int i = 0; i < 5; i++)
{
for (int j = 0; j < i; j++)
cout << " ";
cout << stars;
cout << endl;
}
cout << endl;
return 0;
}
谭浩强c++第三版5-11
最新推荐文章于 2024-08-03 18:36:56 发布