0% found this document useful (0 votes)
26 views2 pages

Namespace Int Int: #Include #Include Using

This C++ program allows a user to input information about multiple products, including name, quantity, unit price, and total price. It stores this data in arrays, calculates subtotals and a grand total, and outputs a formatted table with the product information and totals. The program prompts the user for the number of products, then loops to collect each product's details via input and calculates the total price before outputting a summary table with all product and total values.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views2 pages

Namespace Int Int: #Include #Include Using

This C++ program allows a user to input information about multiple products, including name, quantity, unit price, and total price. It stores this data in arrays, calculates subtotals and a grand total, and outputs a formatted table with the product information and totals. The program prompts the user for the number of products, then loops to collect each product's details via input and calculates the total price before outputting a summary table with all product and total values.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 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