





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!






#include
{ if(B[i].bookNo == bookNo) { price = B[i].price; flag = 1; } } if(flag == 0) { cout<<"\n Please enter a valid book no : "; } else {amount = price*copies; cout<<"\n The total amount of your purchase is : "<<amount; } }}; int main() { Book B[5]; int option = 1; for(int i=0;i<5;i++) { B[i].takedata(); } do { cout<<"\n Please choose from the below options."; cout<<"\n 1. Display all the books info"; cout<<"\n 2. Make a purchase"; cout<<"\n 0. Exit"; cout<<"\n Please enter you choice : "; cin>>option; if(option == 1) { for(int i=0;i<5;i++) { cout<<"\n Data for book "<<i+1; B[i].displaydata(); } } else if(option == 2)
#include
#include
cout<<"Enter the imaginary part of First Number: "; cin>>imag1; Complex obj1(real1,imag1); obj1.print(); cout<<"Enter the Real part of Second Number: "; cin>>real2; cout<<"Enter the Imaginary part of second number: "; cin>>imag2; Complex obj2(real2,imag2); obj2.print(); Complex c; c = obj1.add(obj2); cout<<"Addition is : ("<<c.getReal()<<")+("<<c.getImag()<<")i"<<endl; c= obj1.sub(obj2); cout<<endl<<"Subtraction is : ("<<c.getReal()<<")+("<<c.getImag()<<")i"<<endl; c= obj1.mult(obj2); cout<<endl<<"Multiplication is : ("<<c.getReal()<<")+("<<c.getImag()<<")i"<<endl; return 0; }
#include