Define a structure Ticket that holds data items of a carnival which includes: name of the carnival, total amount of tickets, price per ticket, total tickets sold and total sales. The total sale is based on the price per ticket and total tickets sold. Input the data into structure type variable and print it on the screen.
in c++

Recommended Answers

Do you know how to define a structure?

Jump to Post

Do you have any specific question with a difficulty while doing this homework?

Jump to Post

All 5 Replies

Do you know how to define a structure?

Do you have any specific question with a difficulty while doing this homework?

Start by breaking the problem down.
1. Define a structure named "Ticket"--How do you define a structure in C++?
2. How do you define data items for/in a structure? Define the following:
-name of the carnival
-total amount of tickets
-price per ticket
-total tickets sold
-total sales
3. What is the formula to compute total sale using price per ticket and total tickets sold?
4. How do you use (input the data into) the structure?
5. How do you print the data contained in the structure to the screen?

You know cout uses operator<<, now you want to do the reverse, operator>> with your class Ticket.

ifra if some one helps you then forward it to me plxxx

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.