Created the solution_7.cpp
This commit is contained in:
parent
c81903a4c8
commit
d11511774d
19
units/2023_10_27/solution_7.cpp
Normal file
19
units/2023_10_27/solution_7.cpp
Normal file
@ -0,0 +1,19 @@
|
||||
#include <iostream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
// Variablen deklarieren
|
||||
int Jahr;
|
||||
bool Schaltjahr;
|
||||
|
||||
// Eingaben einlesen
|
||||
cout << "Geben Sie eine Jahreszahl ein: ";
|
||||
cin >> Jahr;
|
||||
|
||||
// Berechnen
|
||||
Schaltjahr = (Jahr % 4 == 0 && Jahr % 100 != 0) || Jahr % 400 == 0;
|
||||
|
||||
// Ausgabe
|
||||
cout << "Das Jahr ist " << (Schaltjahr ? "ein " : "kein ") << "Schaltjahr." << endl;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user