c语言i++和++i程序
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr(); //to clear the screen
int i,j,k,n;
cout<<“How many lines?”;
cin>>n;
n*=2;
for(i=0;i<n;i+=2)
{
cout<<“n”;
for(j=n;j>i;j-=2)
cout<<” “;
for(k=0;k<=i;++k)
cout<<“*”;
}
getch(); //to stop the screen
}
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr(); //to clear the screen
int i,j,k,n;
cout<<“How many lines?”;
cin>>n;
n*=2;
for(i=0;i<n;i+=2)
{
cout<<“n”;
for(j=n;j>i;j-=2)
cout<<” “;
for(k=0;k<=i;++k)
cout<<“*”;
}
getch(); //to stop the screen
}
翻译自: https://www.thecrazyprogrammer.com/2012/10/c-program-to-print-following-pattern.html
c语言i++和++i程序