mirror of
https://inf-git.fh-rosenheim.de/studavrije7683/cplusplus-training.git
synced 2025-04-19 22:49:55 +00:00
39 lines
690 B
C++
39 lines
690 B
C++
#include <iostream>
|
|
#include <cstdlib>
|
|
|
|
using namespace std;
|
|
|
|
class Tier
|
|
{
|
|
private:
|
|
float Einnahme;
|
|
float Gewicht;
|
|
float Tagespreis;
|
|
|
|
public:
|
|
void Daten_abfragen() //Deklaration und Definition der Methode Daten_abfragen
|
|
{
|
|
cout << "Wie steht der Tagespreis? " << endl;
|
|
cin >> Tagespreis;
|
|
cout << "Wie ist das Gewicht? " << endl;
|
|
cin >> Gewicht;
|
|
}
|
|
|
|
void Einnahme_berechnen(){ //Deklaration und Definition der Methode Einnahme_berechnen
|
|
Einnahme = Gewicht*Tagespreis;
|
|
cout << "Einnahme: " << Einnahme << endl;
|
|
}
|
|
};
|
|
|
|
int main(){
|
|
Tier schwein;
|
|
schwein.Daten_abfragen(); //Methodenaufrufe
|
|
schwein.Einnahme_berechnen();
|
|
|
|
cout << endl << endl;
|
|
|
|
system("PAUSE");
|
|
return 0;
|
|
}
|
|
|