Se me cierra al ingresar datos ayuda!!!
Publicado por Livingsthon (3 intervenciones) el 28/07/2019 22:16:29
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#include <iostream>
#include <conio.h>
#include <stdlib.h>
#include <cstdlib>
using namespace std;
struct biblioteca{
string libro;
string fecha_publicacion;
string autor;
int existencia;
int pedido;
float costo;
float precio;
} empleado ;
int n;
void Ingreso(struct biblioteca *p,int n);
void Calculo(struct biblioteca *p, int n);
void Mostrar(struct biblioteca *p, int n);
int main (){
int n ;
cout<<"Ingrese la cantidad de libros :";
cin>>n;
int v;
struct biblioteca empleado[n];
Ingreso(&empleado[v],n);
Calculo(&empleado[v],n);
system("cls");
Mostrar(&empleado[v],n);
cout<<endl;
cout<<"El precio total es :"<<(&empleado[v],n)<<endl;
system("PAUSE");
getch ();
return 0;
}
void Ingreso(struct biblioteca *p, int n){
//struct biblioteca empleado[n];
for(int i=0;i<n;i++){
cout<<"Ingrese el nombre del libro "<<i+1<<":"<<endl;fflush(stdin);
getline(cin,p->libro);
cout<<"Ingrese la fecha de publicacion "<<i+1<<":"<<endl;fflush(stdin);
getline(cin,p->fecha_publicacion);
cout<<"Ingrese el autor "<<i+1<<" :"<<endl;fflush(stdin);
getline(cin,p->autor);
cout<<"Ingrese la existencia "<<i+1<<" :"<<endl;fflush(stdin);
cin>>p->existencia;
cout<<"Ingrese el pedido "<<i+1<<" :"<<endl;fflush(stdin);
cin>>p->pedido;
cout<<"Ingrese el costo "<<i+1<<" :"<<endl;fflush(stdin);
cin>>p->costo;
cout<<endl;
}
}
void Calculo(struct biblioteca *p, int n){
float precio ;
for(int i=0;i<n;i++){
if(p->costo < 100 ){
p->costo = p->costo * 0.20 +precio ;
precio=p->costo * p->pedido ;
}
else( p->costo > 100 ) ;{
p->costo = p->costo * 0.25 +precio;
precio= p->costo * p->pedido ;
}
}
}
void Mostrar(struct biblioteca *p, int n){
int v;
for(int i=0;i<n;i++){
cout<<"MOSTRANDO INFORMACION "<<i+1<<":"<<endl;
cout<<"REGISTRO "<<i+1<<" : "<<p->libro<<endl;
cout<<"REGISTRO "<<i+1<<" : "<<p->fecha_publicacion<<endl;
cout<<"REGISTRO "<<i+1<<" : "<<p->autor<<endl;
cout<<"REGISTRO "<<i+1<<" : "<<p->existencia<<endl;
cout<<"REGISTRO "<<i+1<<" : "<<p->pedido<<endl;
cout<<"REGISTRO "<<i+1<<" : "<<p->costo<<endl;
cout<<endl;
}
}
Valora esta pregunta


0