Está en la página 1de 1

#include <stdio.

h>
#include <conio.h>
#include <stdlib.h>
main()
{
float cot, importe;
int dni, cant;
cant=1;
FILE* cotitxt = fopen("coti.txt","r");
FILE* historialtxt = fopen("historial.txt","a");
fscanf(cotitxt, "%f",&cot);
while(cant!=0)
{
printf(" Software de compra de dolares\n\n-Ingrese la cantidad de dolares que
desea comprar: ");
scanf("%i",&cant);
if(cant>200)
{
importe=cot*cant;
printf("-Ingrese su documento: ");
scanf("%i",&dni);
fprintf(historialtxt, " DNI: %i ",dni);
fprintf(historialtxt, "- Cantidad de usd comprados: %i",cant);
printf("-El importe es: $%2.f\n\n",importe);
system("pause");
system("cls");
}
else
{
if(cant>0)
{
importe=cot*cant;
printf("-El importe es: $%2.f\n\n",importe);
system("pause");
system("cls");
}
else
{
printf("Usted esta saliendo del programa\n\n");
system("pause");
system("cls");
}
}
}
fclose(cotitxt);
fclose(historialtxt);
getch();
return 0;
}

También podría gustarte