Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- class Kupura{
- public:
- int sum; //поле 1
- int amount; //поле 2
- int total;
- void distance(){
- sum = 0;
- amount = 0;
- }
- int set_sum(){
- return sum;
- }
- double set_amount(){
- return amount;
- }
- double calculate_total(int sum, int amount){
- int total = sum*amount; // переводим в минуты
- return total;
- }
- };
- class Euro: public Kupura{
- public:
- double calc = 74.3; //стоимость одного евро
- double calculate_total(int total){
- double sum_euro = total/calc;
- return sum_euro;
- }
- };
- int main(){
- Kupura k;
- Euro e;
- cout << "Введите значение купюры" << endl;
- cin >> k.sum;
- cout << "Введите количество купюр" << endl;
- cin >> k.amount;
- double total = k.calculate_total(k.sum, k.amount);
- double total_e = e.calculate_total(total);
- cout << "Сумма: " << total << endl;
- cout << "Сумма в евро: " << total_e << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement