c++ program that accepts customer data

,calculates discount based on the age and ticket price depending on the schemes offered by transport company.

55hgvn

Sure! Here's an example C++ program that accepts customer data, calculates discounts based on age, and calculates ticket prices depending on the schemes offered by a transport company:

```cpp
#include <iostream>
using namespace std;

int main() {
// Accepting customer data
string name;
int age;
double ticketPrice;

cout << "Enter customer name: ";
getline(cin, name);

cout << "Enter customer age: ";
cin >> age;

cout << "Enter ticket price: ";
cin >> ticketPrice;

// Calculating discount based on age
double discount = 0.0;
if (age < 18) {
discount = 0.25; // 25% discount for customers under 18
} else if (age >= 60) {
discount = 0.5; // 50% discount for customers 60 or older
}

// Calculating final ticket price with discount
double discountedPrice = ticketPrice - (ticketPrice * discount);

// Displaying the results
cout << "Customer Name: " << name << endl;
cout << "Customer Age: " << age << endl;
cout << "Ticket Price: $" << ticketPrice << endl;
cout << "Discount: " << (discount * 100) << "% " << endl;
cout << "Discounted Price: $" << discountedPrice << endl;

return 0;
}
```

In this program, we first accept the customer's name, age, and ticket price using `cout` and `cin`. Then, we calculate the discount based on age using conditional statements (`if` and `else if`). If the customer is under 18, they receive a 25% discount, and if they are 60 or older, they receive a 50% discount. After calculating the discounted price, we display the customer's name, age, ticket price, discount percentage, and the final discounted price.

Note: This is just a simple example to show the logic. In a real program, you might want to add more validation checks and error handling.