Guest User

Untitled

a guest
Dec 9th, 2019
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.98 KB | None | 0 0
  1. #include <stdio.h>
  2. int main(){
  3. int x, x1, y, y1;
  4. int i, j;
  5. char myArray[80][80];
  6. ​
  7. printf("#1 x y x1 y1):");
  8. if(scanf("%d,%d,%d,%d", &x, &y, &x1, &y1) < 0 || x==x1 || y==y1 || x+x1+y+y1 > 321){
  9.     printf("erro");
  10.  return 1;
  11. }
  12.  for(i = 0; i < 80; i++){
  13.     for(j = 0; j < 80; j++)
  14.         myArray[i][j] = 'Z';
  15.     }
  16.    
  17.  for(i = y-1; i < y1; i++){
  18.     for (j = x-1; j <  x1; j++)
  19.         myArray[i][j] = '*';
  20.     }
  21. ​
  22.  for(i = y; i < y1- 1; i++){
  23.     for (j = x; j < x1 - 1 ; j++)
  24.         myArray[i][j] = ' ';   
  25.     }  
  26. ​
  27. printf("#2 x y x1 y1: ");
  28. if (scanf("%d,%d,%d,%d", &x, &y, &x1, &y1) < 0 || x==x1 || y==y1 || x+x1+y+y1 > 321){
  29.     printf("error");
  30.  return 1;
  31. }
  32. ​
  33.  for(i = y-1; i < y1; i++ ){
  34.     for(j = x-1; j <  x1; j++)
  35.         myArray[i][j] = '*';
  36.     }  
  37. ​
  38.  for(i = y; i < y1- 1; i++){
  39.     for(j = x; j < x1 - 1 ; j++)
  40.         myArray[i][j] = ' ';
  41.     }  
  42. ​
  43.  for ( i = 0; i < 80; i++ ){
  44.     for ( j = 0; j < 80; j++ ){
  45.         printf( "%C", myArray[i][j]);
  46.     }
  47.    
  48.     printf( "\n" );
  49.  }
  50. getchar();
  51. }
Advertisement
Add Comment
Please, Sign In to add comment