Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- int main() {
- std::cout << "Please enter the number of drivers in your family: ";
- int drivers; std::cin >> drivers;
- std::string name;
- unsigned int age;
- for (int i = 0; i < drivers; i++) {
- std::cout << "Driver " << i+1 << " name: ";
- std::cin >> name;
- std::cout << "Driver " << i+1 << " age: ";
- std::cin >> age;
- int cost = 1000;
- if (age < 16) {
- cost *= 0;
- } else if (age <= 19) {
- cost *= 1.15;
- } else if (age <= 25) {
- cost *= 1.05;
- } else {
- cost *= 0.9;
- }
- std::cout << "The cost of insurance for " << name << " is $" << cost \
- << ".\n\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement