sábado, 24 de noviembre de 2012

PROGRAMA PARA CALCULAR EL TOTAL A PAGAR DE LA COMPRA POR EL NUMERO ESCOGIDO AL AZAR

EN UN SUPERMERCADO SE HACE UNA PROMOCIÓN, MEDIANTE LA CUAL EL CLIENTE OBTIENE UN DESCUENTO DEPENDIENDO DE UN NUMERO QUE SE ESCOGE AL AZAR. SI EL NUMERO ESCOGIDO ES MENOR QUE 74 EL DESCUENTO ES DEL 15% SOBRE EL TOTAL DE LA COMPRA, SI ES MAYOR O IGUAL A 74 EL DESCUENTO ES DEL 20%. OBTENER CUANTO DINERO SE LE DESCUENTA. ESTE PROGRAMA ESTA REALIZADO EN LENGUAJE C++.

#include<iostream.h>
#include<stdio.h>
#include<conio.h>
void main (void)
{
char opcion='s';
float tc,num,desc;
while(opcion=='s')
{
textcolor(9);
textbackground(8);
clrscr();
gotoxy(10,6);cout<<"CALCULAR EL TOTAL DE LA COMPRA POR EL NUMERO AZAR";
do{
gotoxy(10,8);cout<<"ingrese total de la compra ";
gotoxy(40,8);cin>>tc;
gotoxy(10,10);cout<<"ingrese el numero al azar ";
gotoxy(40,10);cin>>num;
if(num<74)
{
desc=tc*0.15;
gotoxy(10,16);cout<<"usted tiene un descuento  del 15% del total de la compra";
gotoxy(10,18);cout<<"el total a pagar por las compras  es:   "<<desc;
}
else
if(num>=74)
{
desc=tc*0.20;
gotoxy(10,16);cout<<"usted tiene un descuento  del 20% del total de la compra";
gotoxy(10,18);cout<<"el total a pagar por las compras  es:   "<<desc;
gotoxy(10,14);cout<<"el total a pagar por las compras  es:   "<<desc;
}
gotoxy(14,20);cout<<"desea registrar otras compras  s/n" ;
opcion=getch();
}while((opcion!='s')&&(opcion!='n'));
}

No hay comentarios:

Publicar un comentario