SHARE
TWEET

Untitled

a guest Dec 9th, 2019 98 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. int main(){
  3. int x, x1, y, y1;
  4. int i, j;
  5. char myArray[80][80];
  6. printf("#1 x y x1 y1):");
  7. if(scanf("%d,%d,%d,%d", &x, &y, &x1, &y1) < 0 || x==x1 || y==y1 || x+x1+y+y1 > 321){
  8.     printf("erro");
  9.  return 1;
  10. }
  11.  for(i = 0; i < 80; i++){
  12.     for(j = 0; j < 80; j++)
  13.         myArray[i][j] = 'Z';
  14.     }
  15.    
  16.  for(i = y-1; i < y1; i++){
  17.     for (j = x-1; j <  x1; j++)
  18.         myArray[i][j] = '*';
  19.     }
  20.  for(i = y; i < y1- 1; i++){
  21.     for (j = x; j < x1 - 1 ; j++)
  22.         myArray[i][j] = ' ';   
  23.     }  
  24. printf("#2 x y x1 y1: ");
  25. if (scanf("%d,%d,%d,%d", &x, &y, &x1, &y1) < 0 || x==x1 || y==y1 || x+x1+y+y1 > 321){
  26.     printf("error");
  27.  return 1;
  28. }
  29.  for(i = y-1; i < y1; i++ ){
  30.     for(j = x-1; j <  x1; j++)
  31.         myArray[i][j] = '*';
  32.     }  
  33.  for(i = y; i < y1- 1; i++){
  34.     for(j = x; j < x1 - 1 ; j++)
  35.         myArray[i][j] = ' ';
  36.     }  
  37.  for ( i = 0; i < 80; i++ ){
  38.     for ( j = 0; j < 80; j++ ){
  39.         printf( "%C", myArray[i][j]);
  40.     }
  41.    
  42.     printf( "\n" );
  43.  }
  44. getchar();
  45. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top