/ Published in: C++
this small script will make a small triangle of numbers; script and example are below.
Expand |
Embed | Plain Text
#include <cstdlib> #include <iostream> #include <string> using namespace std; int main() { int a=0, b=0, c=1, i; do{ for (i=9;i!=0;i--) { string space (i,' '); cout << space; for (a=0;a<c;a++) { cout << a; } c++; for (b=a;b!=-1;b--) { cout << b; } cout << "\n"; } }while (c != 10); system("pause"); } // EXAMPLE: // 010 // 01210 // 0123210 // 012343210 // 01234543210 // 0123456543210 // 012345676543210 // 01234567876543210 //0123456789876543210
You need to login to post a comment.
