Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(){
- int x, x1, y, y1;
- int i, j;
- char myArray[80][80];
-
- printf("#1 x y x1 y1):");
- if(scanf("%d,%d,%d,%d", &x, &y, &x1, &y1) < 0 || x==x1 || y==y1 || x+x1+y+y1 > 321){
- printf("erro");
- return 1;
- }
- for(i = 0; i < 80; i++){
- for(j = 0; j < 80; j++)
- myArray[i][j] = 'Z';
- }
- for(i = y-1; i < y1; i++){
- for (j = x-1; j < x1; j++)
- myArray[i][j] = '*';
- }
-
- for(i = y; i < y1- 1; i++){
- for (j = x; j < x1 - 1 ; j++)
- myArray[i][j] = ' ';
- }
-
- printf("#2 x y x1 y1: ");
- if (scanf("%d,%d,%d,%d", &x, &y, &x1, &y1) < 0 || x==x1 || y==y1 || x+x1+y+y1 > 321){
- printf("error");
- return 1;
- }
-
- for(i = y-1; i < y1; i++ ){
- for(j = x-1; j < x1; j++)
- myArray[i][j] = '*';
- }
-
- for(i = y; i < y1- 1; i++){
- for(j = x; j < x1 - 1 ; j++)
- myArray[i][j] = ' ';
- }
-
- for ( i = 0; i < 80; i++ ){
- for ( j = 0; j < 80; j++ ){
- printf( "%C", myArray[i][j]);
- }
- printf( "\n" );
- }
- getchar();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement