Created
December 24, 2017 08:46
-
-
Save hansen033/5b2341f22969b0eafdfdfb1fd6bf9de2 to your computer and use it in GitHub Desktop.
2017/12/21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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