Skip to content

Instantly share code, notes, and snippets.

@hansen033
Created December 24, 2017 08:46
Show Gist options
  • Save hansen033/5b2341f22969b0eafdfdfb1fd6bf9de2 to your computer and use it in GitHub Desktop.
Save hansen033/5b2341f22969b0eafdfdfb1fd6bf9de2 to your computer and use it in GitHub Desktop.
2017/12/21
#include <iostream>
using namespace std;
int main()
{
int x;
cout << "please input the num:";
cin >> x;
cout << "type 1:\n";
for ( int t = 0 ; t < x ; t ++ ){
for ( int t2 = 0 ; t2 < t + 1 ; t2 ++ ){
cout << "*";
}
cout << "\n";
}
cout << "type 2:\n";
for ( int t = x ; t > 0 ; t -- ){
for ( int t2 = t ; t2 > 0 ; t2 -- ){
cout << "*";
}
cout << "\n";
}
cout << "type 3:\n";
for ( int t = 0 ; t < x ; t ++ ){
for ( int t2 = x - t ; t2 > 1 ; t2 -- ){
cout << " ";
}for ( int t3 = 0 ; t3 < t + 1 ; t3 ++ ){
cout << "*";
}
cout << "\n";
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment