Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string.h>
- #define MAPA_SIZE 50
- typedef struct {
- char nome[39];
- int peso;
- float preco;
- } produto;
- #define MAX_LOTES 1000 // Maximum number of lotes
- int main() {
- int quantProdutos;
- int quantCentros;
- int quantlotes;
- printf("Digite a quantidade de produtos e centros: ");
- scanf("%d %d", &quantProdutos, &quantCentros);
- quantlotes = quantProdutos / quantCentros;
- if (quantProdutos % quantCentros == 0) {
- }
- if (quantlotes > MAX_LOTES) {
- printf("Quantidade de lotes excede o limite.\n");
- return 0;
- }
- int lotes[MAX_LOTES];
- produto compras[quantProdutos];
- for (int i = 0; i < quantProdutos; i++) {
- strcpy(compras[i].nome, "NULL");
- compras[i].peso = 0;
- compras[i].preco = 0;
- }
- int centros[quantCentros][2];
- for (int i = 0; i < quantCentros; i++) {
- for (int j = 0; j < 2; j++) {
- centros[i][j] = 0;
- }
- }
- for (int i = 0; i < quantCentros; i++) {
- printf("\nDigite as coordenadas do centro %d: ", i + 1);
- scanf("%d %d", ¢ros[i][0], ¢ros[i][1]);
- }
- char mapa[MAPA_SIZE][MAPA_SIZE];
- for (int i = 0; i < MAPA_SIZE; i++) {
- for (int j = 0; j < MAPA_SIZE; j++) {
- mapa[i][j] = '.'; // Fill the mapa with a default symbol (e.g., '.')
- }
- }
- for (int i = 0; i < quantCentros; i++) {
- int cX = centros[i][0];
- int cY = centros[i][1];
- mapa[cX][cY] = 'C'; // Symbol representing the center
- }
- for (int i = 0; i < MAPA_SIZE; i++) {
- for (int j = 0; j < MAPA_SIZE; j++) {
- printf("%c", mapa[i][j]);
- }
- printf("\n");
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment