Advertisement
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'};
- int main ()
- {
- do
- {
- std::cout<<"Enter figure a, b, c, d, e, f, g, h, i, j or x to exit\n";
- std::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 {std::cout<<"Incorrect input\n"; continue; };
- for (int y=0; y < maxCord; ++y)
- {
- for (int x = 0; x < maxCord; ++x)
- {
- //((x+y) >= (maxCord-1) and x >= y) or ((x+y) >= (maxCord-1) and x >= y)
- std::cout<<' '<< ( ( (a*(x+y) >= a*(maxCord-1) and b*x >= b*y) or (c*(x+y) >= c*(maxCord-1) and d*x >= d*y) ) ? '*' : ' ') <<' ';
- }
- std::cout << '\n';
- }
- std::cout << '\n';
- } while (input!='x');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement