that_one_nigga_you_k

amazon delivery

Jul 14th, 2023
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.84 KB | None | 0 0
  1. #include <string.h>
  2.  
  3. #define MAPA_SIZE 50
  4.  
  5. typedef struct {
  6.     char nome[39];
  7.     int peso;
  8.     float preco;
  9. } produto;
  10.  
  11. #define MAX_LOTES 1000  // Maximum number of lotes
  12.  
  13. int main() {
  14.     int quantProdutos;
  15.     int quantCentros;
  16.     int quantlotes;
  17.    
  18.     printf("Digite a quantidade de produtos e centros: ");
  19.     scanf("%d %d", &quantProdutos, &quantCentros);
  20.    
  21.     quantlotes = quantProdutos / quantCentros;
  22.    
  23.     if (quantProdutos % quantCentros == 0) {
  24.        
  25.     }
  26.    
  27.     if (quantlotes > MAX_LOTES) {
  28.         printf("Quantidade de lotes excede o limite.\n");
  29.         return 0;
  30.     }
  31.    
  32.     int lotes[MAX_LOTES];
  33.    
  34.     produto compras[quantProdutos];
  35.    
  36.    
  37.     for (int i = 0; i < quantProdutos; i++) {
  38.         strcpy(compras[i].nome, "NULL");
  39.         compras[i].peso = 0;
  40.         compras[i].preco = 0;
  41.     }
  42.    
  43.     int centros[quantCentros][2];
  44.    
  45.    
  46.     for (int i = 0; i < quantCentros; i++) {
  47.         for (int j = 0; j < 2; j++) {
  48.             centros[i][j] = 0;
  49.         }
  50.     }
  51.    
  52.     for (int i = 0; i < quantCentros; i++) {
  53.         printf("\nDigite as coordenadas do centro %d: ", i + 1);
  54.         scanf("%d %d", &centros[i][0], &centros[i][1]);
  55.     }
  56.    
  57.     char mapa[MAPA_SIZE][MAPA_SIZE];
  58.    
  59.     for (int i = 0; i < MAPA_SIZE; i++) {
  60.         for (int j = 0; j < MAPA_SIZE; j++) {
  61.             mapa[i][j] = '.';  // Fill the mapa with a default symbol (e.g., '.')
  62.         }
  63.     }
  64.    
  65.     for (int i = 0; i < quantCentros; i++) {
  66.         int cX = centros[i][0];
  67.         int cY = centros[i][1];
  68.         mapa[cX][cY] = 'C';  // Symbol representing the center
  69.     }
  70.    
  71.     for (int i = 0; i < MAPA_SIZE; i++) {
  72.         for (int j = 0; j < MAPA_SIZE; j++) {
  73.             printf("%c", mapa[i][j]);
  74.         }
  75.         printf("\n");
  76.     }
  77.    
  78.     return 0;
  79. }
  80.  
Add Comment
Please, Sign In to add comment