martes, 5 de noviembre de 2019

Ejercicio 16

#include <stdio.h>
#include <windows.h>
#include <iostream>
using namespace std;

void captura();
void calcular();
void impresion();
void gotoxy(int x,int y){
HANDLE hcon;
hcon=GetStdHandle(STD_OUTPUT_HANDLE);
COORD dwpos;
dwpos.X=x;
dwpos.Y=y;
SetConsoleCursorPosition(hcon,dwpos);
}
char Nombre[20];
int Factura;
float I,IVA,P1,P2,P3,Total;

int main(){
system("color F0");
captura();
system("pause");
system("cls");
calcular();
impresion();
system("pause");
return 0;
}

void captura(){
cout<<"Ingrese su nombre:";
gets(Nombre);
cout<<"Ingrese el numero de factura:";
cin>>Factura;
cout<<"Ingrese el precio del primer producto:";
cin>>P1;
cout<<"Ingrese el precio del segundo producto:";
cin>>P2;
cout<<"Ingrese el precio del tercer producto:";
cin>>P3;
}

void calcular(){
Total=P1+P2+P3;
I=Total*0.016;
IVA=I+Total;
cout<<"Realizando su factura";
for(int i=0; i<=2; i++){
cout<<".";
Sleep(300);
}
}

void impresion(){
cout<<endl;
cout<<"       Distribuidora"<<endl;
cout<<"          Alemana"<<endl;
cout<<endl;
cout<<"  Cliente:"<<Nombre<<endl;
cout<<"  Factura:"<<Factura<<endl;
cout<<endl;
cout<<"              Precio"<<endl;
cout<<" Producto 1:   "<<P1<<endl;
cout<<" Producto 2:   "<<P2<<endl;
cout<<" Producto 3:   "<<P3<<endl;
cout<<" Total:        "<<Total<<endl;
cout<<" IVA:          "<<IVA;
for(int x=0; x<=24; x++){
gotoxy(x,0);
cout<<"_";
gotoxy(x,24);
cout<<"_";
}
for(int y=1; y<=24; y++){
gotoxy(0,y);
cout<<"|";
gotoxy(24,y);
cout<<"|";
}
}

No hay comentarios:

Publicar un comentario