You are on page 1of 2

#include <iostream>

#include "stdio.h"

using namespace std;

int main() {

int cantProductos, i, contador = 0, total = 0;

string prductos [5];


int valores [5][3];// cantidad, valor unitario,valor total

printf("INGRESE LA CANTIDAD DEPRODUCTOS");


scanf("%i", &cantProductos);

for (i=0; i < cantProductos; i++) {


contador++;
printf(" ***** Prducto **** # %i \n" ,contador, "*******");

printf("Nombre del Producto \n");


scanf("%s", &prductos[i]);

printf("Cantidad \n");
scanf("%i",&valores[i][0] );

printf("Valor Unitario \n");


scanf("%i",&valores[i][1]);

valores[i][2]= valores[i][0]*valores[i][1];

}
printf("**************************************************************
****************** \n");
printf("%10s", "Nombre Producto");
printf("%15s", "Cantidad" );
printf("%20s", "Precio Unitario");
printf("%25s", "Precio Total");

for (i=0; i< cantProductos; i++) {


printf("\n");
printf("%10s ",&prductos[i]);
printf("%15i ",valores[i][0]);
printf("%20i ",valores[i][1]);
printf("%25i ",valores[i][2]);
total= total+valores[i][2];
}
printf("\n");
printf("%45s","Total");
printf("%15i \n",total);
printf("**************************************************************
****************** \n\n");

return 0;
}

You might also like