Elaborar Un Programa En C, Que Maneje La Información De Una Cuenta De Teléfono. Debe Haber Un Menú Que Maneje El Proceso De La Siguiente Forma:
orlando.0322 de Febrero de 2015
7.371 Palabras (30 Páginas)434 Visitas
#include <stdio.h>
#include <conio.h>
#include<stdlib.h>
main()
{
int opcion, opcion2, opcion3, NoSi;
int telefono, tiempo[3], menu, menu2,totalmin, temp;
float saldo, costo, subtotal, total;
telefono=0;
saldo=0;
menu=0;
menu2=0;
temp=0;
costo=0;
tiempo[0]=0;
tiempo[1]=0;
tiempo[2]=0;
subtotal=0;
totalmin=0;
total=0;
do
{
system("CLS");
system("color 1F");
printf("\n\n\n CREADO POR PONER EL NOMBRE\n");
printf("\n\n TELEFONICA PONER EL NOMRE\n");
printf("\n\n******************************************************\n");
printf("* SELECIONE LA OPERACION QUE DESEE REALIZAR: *\n");
printf("* 1. Registrar numero de telefono *\n");
printf("* 2. Cargar cuenta de telefono *\n");
printf("* 3. Hacer llamadas telefonicas *\n");
printf("* 4. Ver estado de cuenta *\n");
printf("* 5. Salir del programa *\n");
printf("******************************************************\n");
printf("\n\n SELECCIONE UNA OPCION: ");
scanf("%d", &opcion);
switch(opcion)
{
case 1:
system("color 2F");
system("CLS");
printf("*****************************************************\n");
printf("* INTRODUSCA EL NUMERO DE TELEFONO: ");
scanf("%d",&telefono);
break;
case 2:
if(telefono==0)
{
system("color 3F");
system("CLS");
printf("*****************\n");
printf("* ADVERTENCIA *\n");
printf("*****************\n");
printf("\nDEBE REGISTRAR PRIMERO UN NUMERO TELEFONICO ANTES DE REALIZAR ESTA OPERACION\n");
getch();
}
else
{
system("color 4F");
system("CLS");
printf("************************************************\n");
printf("* INTRODUZCA EL VALOR DE TARJETA A CARGAR: *\n");
printf("* 1. $5.00 *\n");
printf("* 2. $10.00 *\n");
printf("* 3. $20.00 *\n");
printf("************************************************\n");
printf("\n\n SELECCIONE UNA OPCION: ");
scanf("%d", &opcion2);
switch(opcion2)
{
case 1:
saldo=saldo+5.00;
printf("\nEL TELEFONO %d \n", telefono);
printf("\nSE HA CARGADO SATISFACTORIAMENTE CON $5.00\n");
getch();
break;
case 2:
saldo=saldo+10.00;
printf("\nEL TELEFONO %d \n", telefono);
printf("\nSE HA CARGADO SATISFACTORIAMENTE CON $10.00\n");
getch();
break;
case 3:
saldo=saldo+20.00;
printf("\nEL TELEFONO %d \n", telefono);
printf("\nSE HA CARGADO SATISFACTORIAMENTE CON con $20.00\n");
getch();
break;
}
}
break;
case 3:
if(telefono==0)
{
system("color 3F");
system("CLS");
printf("*****************\n");
printf("* ADVERTENCIA *\n");
printf("*****************\n");
printf("\nDEBE REGISTRAR PRIMERO UN NUMERO TELEFONICO ANTES DE REALIZAR ESTA OPERACION\n");
getch();
}
else{
menu2=0;
do
{
system("color 5F");
system("CLS");
printf("************************************************************\n");
printf("* LLAMDAS TELEFONICAS *\n");
printf("* Telefono: %d *\n", telefono);
printf("************************************************************\n\n");
printf("************************************************************\n");
printf("* 1. Llamada a telefono residencial (0.50c por minuto) *\n");
printf("* 2. Llamada a telefono celular (0.30c por minuto) *\n");
printf("* 3. Llamada a telefono internacional (0.70c por minuto) *\n");
printf("************************************************************\n\n");
printf("************************************************************\n");
printf("TIPO DE LLAMADA: ");
scanf("%d", &opcion3);
switch(opcion3)
{
case 1:
printf("Tiempo de llamda (en minutos): ");
scanf("%d", &temp);
costo=temp*0.50;
if((saldo-costo) >= 0)
{
tiempo[0]=tiempo[0]+temp;
saldo=saldo-(temp*0.50);
temp=0;
printf("HACIENDO LLAMADA!!\n");
printf("Costo de la llamada (en dolares): %.2f", costo);
menu2=1;
getch();
}
else
{
printf("\nNo tiene saldo suficiente para realizar la llamada telefonica...\n");
printf("Desea intentar de nuevo?\n");
printf("1. Si\n");
printf("2. No)\n");
scanf("%d", &NoSi);
switch(NoSi)
{
case 1:
menu2=0;
break;
case 2:
menu2=1;
break;
}
}
break;
case 2:
printf("\nTiempo de llamda (en minutos): ");
scanf("%d", &temp);
...