inital commit, adding all school projects
This commit is contained in:
31
ArbeitStundenRechner/main.cpp
Normal file
31
ArbeitStundenRechner/main.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
const string weekdays[5] = {"Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag"};
|
||||
float workHours[5];
|
||||
float totalHours = 0;
|
||||
|
||||
for (int i = 0; i < size(weekdays); i++) {
|
||||
cout << "Wie viel hast du am " << weekdays[i] << " gearbeitet?" << endl;
|
||||
cin >> workHours[i];
|
||||
}
|
||||
|
||||
for (const float workHour: workHours) {
|
||||
totalHours = totalHours + workHour;
|
||||
}
|
||||
|
||||
cout << endl << "Insgesamt sind das " << totalHours << " Stunden." << endl;
|
||||
|
||||
if (totalHours < 40) {
|
||||
float missingHours = 0;
|
||||
missingHours = 40 - totalHours;
|
||||
cout << "Du hast nicht genug gearbeitet. du hast " << missingHours << " Stunden zu wenig gearbeitet.";
|
||||
} else {
|
||||
float overtime = 0;
|
||||
overtime = totalHours - 40;
|
||||
cout << "Du hast genug gearbeitet. du hast ganze " << overtime << " Ueberstunden" << endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user