Answer to Question #205231 in C++ for shahil

Question #205231

write a code which displays the amount of movies ticket bought by the customer and the seat number .write using functions


1
Expert's answer
2021-06-10T01:37:01-0400
#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; 
}




Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog