#include <iostream>
#include <stdlib.h>
#include <cmath>

using namespace std;


class TMoney {
private:
    int first; // Номинал купюры
    int second; // Количество купюр

public:
    void Init(int nominal, int count) {
        if (nominal != 1
            && nominal != 2
            && nominal != 5
            && nominal != 10
            && nominal != 50
            && nominal != 100
            && nominal != 500
            && nominal != 1000
            && nominal != 5000) {
            cout << "Недопустимый номинал купюры." << endl;
            exit(0);
        }

        first = nominal;
        second = count;
    }

    int Summa () const {
        return first * second;
    }

    void Read () {
        int nominal;
        int count;

        cin >> nominal;
        cin >> count;

        Init(nominal, count);
    }

    void Display () {
        cout << "Номинал купюры: " << first << endl;
        cout << "Количество купюр: " << second << endl;
    }
};

int main() {
    TMoney money;

    money.Read();
    money.Display();

    cout << "Сумма: " << money.Summa() << endl;

    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: