初学C++编写小程序

 

#include "iostream.h"
void main()

{
    int a,b,c,i;
    cout<<"请输入一个整数";
 cin>>a;
 
 for (i=1;i<=a;i++)
 {
  for (c=1;c<=a-i;c++)
  {
            cout<<" ";
  } 
  for (c=1;c<=i*2-1;c++)
  {
   cout<<"*";
  }
  cout<<endl;
 }
}
输出一个正三角形是,行数任意奥!

经过几天的学习,自己编写的编程,希望大家支持一下奥!

原文地址:https://www.cnblogs.com/qiqiBoKe/p/2791635.html