Skip to content

Instantly share code, notes, and snippets.

@masterfermin02
Created July 6, 2020 20:15
Show Gist options
  • Save masterfermin02/bb5fc1034077ef263108271079ea08ad to your computer and use it in GitHub Desktop.
Save masterfermin02/bb5fc1034077ef263108271079ea08ad to your computer and use it in GitHub Desktop.
One of my first cpp script when I started software development 10 year ago.
#include <stdio.h>
#include <conio.c>
/*
Elabore un algoritmo y un programa que permite la entrada de la cantidad de articulo
comprado y la descrpcion de dicho articulo, el sudtotal, itbis y monto a pagar tomando
encuenta que el precio sera 10.20 y el itbis sera 16%.
El Algoritmo:
P1: Inicio
P2: leer cdc, lad
p3: asignar itbis=16%, p=10.20,
p4: calcule subtotal=cdc*p,
p5: calcule montosubtotal+itbis
P6: motras subtotal, itbis, monto
P7: salida
*/
void pantalla()
{
char nom[25], descr[30];
int clave, conclave=0, cantidad;
float itbis=1.6, p=10.20, subtotal;
textbackground(WHITE); clrscr();
inicio:
textbackground(WHITE); clrscr();
textcolor(RED); gotoxy(11,4); printf("SUPERMERCADO FERMIN PERDOMO");
textcolor(RED); gotoxy(2,7); printf("DIGITE NOMBRE DE USUARIO....:[ ]");
gotoxy(2,8); printf("DIGITE CLAVE DE USUARIO...:[ ]");
gotoxy(32,7); scanf("%s", &nom);
textcolor(WHITE); gotoxy(30,8); scanf("%i", &clave);
if(clave==15)
{
textbackground(GREEN); textcolor(RED); gotoxy(22,15); printf("cargando");
gotoxy(16,13); printf(" "); Sleep(3000); printf(" "); Sleep(2000); printf(" "); Sleep(2000); printf(" "); Sleep(2000);
printf(" "); Sleep(2000); printf(" "); Sleep(2000);
goto program;
}
else
{ if(conclave>3) goto fin;
textcolor(RED);textbackground(BLACK);clrscr();
gotoxy(25,12);printf("ERROR \" Clave incorrecta \" ");getch();conclave++;goto inicio;
}
program:
textbackground(WHITE); textcolor(BLACK); clrscr();
printf("DIGITE LA CANTIDAD DE ARTICULO..: ");
scanf("%i", &cantidad);
printf("DIGITE LA DESCRICION DEL ARTICULO..: ");
scanf("%s", &descr);
printf("EL SUBTOTAL ES...%0.2f", cantidad*p);
printf("\nitbis...%0.2f", itbis);
printf("\nMONTO A PAGAR...%0.2f", (cantidad*p)+itbis);
fin:
getch();
}
main()
{
pantalla();
getch();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment