Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- const int maxCord = 9;
- int a,b,c,d;
- char input='x';
- using namespace std;
- char block=' ';
- int main ()
- {
- do
- {
- cout<<"Enter figure a, b, c, d, e, f, g, h, i, j or x to exit\n";
- cin>>input;
- if (input == 'a') {a=-1; b=1; c=1; d=1;}
- else if (input == 'b') {a=-1; b=-1; c=1; d=-1;}
- else if (input == 'c') {a=-1; b=1; c=-1; d=1;}
- else if (input == 'd') {a=1; b=-1; c=1; d=-1;}
- else if (input == 'e') {a=-1; b=1; c=1; d=-1;}
- else if (input == 'f') {a=-1; b=-1; c=1; d=1;}
- else if (input == 'g') {a=-1; b=-1; c=-1; d=-1;}
- else if (input == 'h') {a=1; b=1; c=1; d=1;}
- else if (input == 'i') {a=-1; b=-1; c=-1; d=1;}
- else if (input == 'j') {a=1; b=-1; c=1; d=1;}
- else if (input == 'x') {break;}
- else {cout<<"Incorrect input\n"; continue; };
- for (int y=0; y < maxCord; y++)
- {
- for (int x = 0; x < maxCord; x++)
- {
- block=' ';
- // if ( (a*(x+y) >= a*(maxCord-1) && b*x >= b*y) || (c*(x+y) >= c*(maxCord-1) && d*x >= d*y))
- if ( (a*y >= a*maxCord/2 ) && ( b*x >= b*maxCord/2) || ( c*y >= c*maxCord/2) && (d*x >= d*maxCord/2) )
- {
- block='*';
- }
- cout<<' '<<block<<' ';
- }
- cout << endl;
- }
- cout << endl;
- }
- while (input!='x');
- }
Advertisement
Add Comment
Please, Sign In to add comment