Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include "bruch.h"
- #include<limits>
- using namespace std;
- int integer_input()
- {
- int number;
- while(!(cin >> number)) {
- cin.clear();
- if (cin.get() != '\n')
- {
- cout << "Ganze Zahlen, Fließkommerzahlen werden abgeschnitten: ";
- continue;
- }
- }
- return number;
- }
- int main()
- {
- cout << "Nur GANZE Zahlen" << endl;
- cout << endl << "Erster Bruch" << endl;
- cout << "Zaehler 1: ";
- int zaehler = integer_input();
- cout << "Nenner 1: ";
- int nenner = integer_input();
- bruch B1(zaehler, nenner);
- cout << endl << "Zweiter Bruch" << endl << endl;
- cout << "Zaehler 2: ";
- zaehler = integer_input();
- cout << "Nenner 2: ";
- nenner = integer_input();
- bruch B2(zaehler, nenner);
- cout << endl << "----------" << endl;
- cout << "Berechnungen" << endl;
- cout << "----------" << endl << endl;
- cout << "Addition: " << (B1 + B2).kuerzen() << endl;
- cout << "Subtraktion: " << (B1 - B2).kuerzen() << endl;
- cout << "Multiplikation: " << (B1 * B2).kuerzen() << endl;
- cout << "Division: " << (B1 / B2).kuerzen() << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement