nosotrosprogramamos.es.tl |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Modularidad -Codigo 04.cppp |
|
|
#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
int menu_precios();
float precios(int );
main()
{
int a,salir=0, operacion;
float venta=0.0,precio;
while(salir!=1)
{ system("color b");
printf("1)Comprar otro producton2)salir del sistema");
scanf("%i", &operacion);
switch(operacion)
{
case 1: a=menu_precios();
precio=precios(a);
venta=venta+precio;
system("cls");
break;
case 2: salir=1;
break;
}
}
printf("El total a pagar es de %.2f", venta);
getch();
return 0;
}
int menu_precios()
{
int op;
system("color b");
printf("tttPRECIOS DE LOS SERVICIOSn");
printf("t1)Lapiz= $0.50 tt2)Hojas Bond= $0.05n");
printf("t3)Folder= $0.75 t4)Borrador= $0.50n");
printf("t5)Fastener= $0.50t6)Boligrafo= $1.25");
printf("ntttEleccion: ");
scanf("%i", &op);
getch();
return op;
}
float precios(int a)
{
float precio;
switch(a)
{
case 1:precio=0.50;
break;
case 2:precio=0.05;
break;
case 3:precio=0.75;
break;
case 4:precio=0.80;
break;
case 5:precio=0.50;
break;
case 6:precio=1.25;
break;
}
return precio;
}
My Great Web page
|
|
|
|
|
|
|
Hoy habia 23600 visitantes¡Aqui en esta página! |
|
|
|
|
|
|
|