for loop - asterisk tree looping in c++ -
how flip output around smallest largest?
#include <iostream> using namespace std; int main (){ int m, n; (m=0; m<10; m++) { (n=0; n<m; n++) cout << " "; (n=0; n<(19-2*m); n++) cout << "*"; (n=0; n<m; n++) cout << " "; cout << endl; } return 0; }
just flip it.
#include <iostream> using namespace std; int main (){ int m, n; (m=9; m>=0; m--) { (n=0; n<m; n++) cout << " "; (n=0; n<(19-2*m); n++) cout << "*"; (n=0; n<m; n++) cout << " "; cout << endl; } return 0; }
Comments
Post a Comment