Documentos de Académico
Documentos de Profesional
Documentos de Cultura
#include<fstream>
#include<string>
using namespace std;
struct vuelo{
int codigo;
char aero[50];
char destino[50];
int cant;
double valor;
};
void descuento(vuelo v1[3]);
int main()
{
vuelo v1[3];
ifstream entrada("pvuelos.txt");
for (int i = 0; i < 3; i++)
{
entrada >> v1[i].codigo;
entrada >> v1[i].aero;
entrada >> v1[i].destino;
entrada >> v1[i].cant;
entrada >> v1[i].valor;
}
descuento(v1);
cout << endl;
system("pause");
return 0;
}
void descuento(vuelo v1[3])
{
int subtotal, total = 0, impuesto;
ofstream salida("total.txt");
for (int j = 0; j < 3; j++)
{
subtotal = (v1[j].cant*v1[j].valor);
salida << "codigo:\t" << v1[j].codigo << "\n " <<
"aerolinea:\t" << v1[j].aero << "\n " << "destino:\t" << v1[j].destino
<< "\n " << "cantidad:\t" << v1[j].cant << "\n " << "valor
unitario:\t" << v1[j].valor << "\n " << "subtotal:\t" << subtotal <<
"\n " << endl;
total = subtotal + total;
}
if (total > 25000000)
{
impuesto = total*0.04;
}
else
{
impuesto = total*0.02;
}
salida << "TOTAL VENTAS: \t " << total << endl;
salida << "IMPUESTO: \t" << impuesto << endl;
}