- 1

Can anyone fix my program for me? ;-;

#include <iostream> #include <conio.h> using namespace std; int a,b; void inputbook(int b); void display(int i); void dismenu(); void pickmenu(int a, int b); struct bookrec{ int sr; int price; }bookrec[3]; int main() { int a,b; pickmenu(a,b); getch(); } void dismenu() { int a,b; cout<<"Press 1 to enter record"<<endl; cout<<"Press 2 to display record"<<endl; cout<<"Press 3 to exit"; cin>>a; pickmenu(a,b); } void inputbook(int b) { switch(b){ case 1:{ bookrec[0]; cout<<"Enter Sr.no of book 1: "; cin>>bookrec[0].sr; cout<<"Enter price of book 1: "; cin>>bookrec[0].price;} break; case 2: {bookrec[1]; cout<<"Enter Sr.no of book 2: "; cin>>bookrec[1].sr; cout<<"Enter price of book 2: "; cin>>bookrec[1].price;} break; case 3: {bookrec[2]; cout<<"Enter Sr.no of book 3: "; cin>>bookrec[2].sr; cout<<"Enter price of book 3: "; cin>>bookrec[2].price;} break; } } void display(int i) { char n; bookrec[i]; cout<<"Type a if you want to know the price of a particular book: "; cout<<"Type b if you want to know the price of all books: "; cin>>n; if (n=='a'){ cout<<"Enter serial no. of book: "; cin>>i; cout<<"Price is: "<<bookrec[i].price; } else if(n=='b'){ cout<<"Price of book with serial no."<<bookrec[0].sr<<"is: "<<bookrec[0].price; cout<<"Price of book with serial no."<<bookrec[1].sr<<"is: "<<bookrec[1].price; cout<<"Price of book with serial no."<<bookrec[2].sr<<"is: "<<bookrec[2].price; } } void pickmenu(int a, int b) { switch (a) {case 1:{ cout<<"Press 1 to enter book 1 record"<<endl; cout<<"Press 2 to enter book 2 record"<<endl; cout<<"Press 3 to enter book 3 record"<<endl; cout<<"Press 4 to go to main menu"<<endl; cout<<"Press 5 to exit"<<endl; do{ cout<<"Select your choice"; cin>>b; if (b==1||b==2||b==3){ inputbook(b); } else if (b==4){ dismenu(); } else if (b==5) { return 0; //supposed to exit here } }while(b==1||b==2||b==3||b==4||b==5);} break; case 2: {i

16th Jan 2019, 6:08 PM
Mehroz Ali
Mehroz Ali - avatar
3 Respostas
0
Anyone fixing this pls add string library too, forgot about it. but still doesnt work tho.
16th Jan 2019, 6:15 PM
Mehroz Ali
Mehroz Ali - avatar
0
done its on my home page i think
17th Jan 2019, 11:26 AM
Mehroz Ali
Mehroz Ali - avatar
0
the code is
17th Jan 2019, 11:27 AM
Mehroz Ali
Mehroz Ali - avatar