write a code which displays the amount of movies ticket bought by the customer and the seat number .write using functions
#include<iostream>
#include<string>
using namespace std;
float getAmountMoviesTicket(){
float amount=-1;
while(amount<=0){
cout<<"Enter amount of the movie ticket: ";
cin>>amount;
}
return amount;
}
int getSeatNumber(){
int seatNumber=-1;
while(seatNumber<=0){
cout<<"Enter seat number of the movie ticket: ";
cin>>seatNumber;
}
return seatNumber;
}
void printMovieTicketInfo(float amount,int seatNumber){
cout<<"\nAmount of the movie ticket: "<<amount<<"\n";
cout<<"Seat number of the movie ticket: "<<seatNumber<<"\n\n";
}
int main(){
float amount= getAmountMoviesTicket();
int seatNumber= getSeatNumber();
printMovieTicketInfo(amount,seatNumber);
cin>>seatNumber;
return 0;
}
Comments
Leave a comment