#include <iostream> #include <math.h> #include<Windows.h> using namespace std; int pth (int x) { return -1*x+1; } int main() { int i,j,y; for (int x=-10;x <= 10;x++) { for ( i=-10;i <= x;i++) { if (i==x) { y=pth(x); // cout<<"x="; //cout<<x; //cout<<"y="; //cout<<y; for(j=-10;j<=y;j++) { if(j==y) cout << "*"; else cout << " "; } } } cout << "\n"; system("cls"); Sleep(20); } cin.get(); return 0; }
pth
-1*x+1
y = mx + c
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)