Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
You are viewing an older revision! See the latest version
Homepage
Spiel Kalt oder Heiß¶
include the mbed library with this snippet
#include <iostream>
#include "time.h"
using namespace std;
int main()
{
time_t now;
time_t final;
double seconds;
int Eingabe;
int ZahlFix;
int Versuche=0;
cout << "Geben Sie ein Zahl ein: ";
cin >> ZahlFix;
system("CLS");
if (ZahlFix >= 1 && ZahlFix <= 10)
{
time(&now);
do
{
cout << "Versuchen Sie jetzt:";
cin >> Eingabe;
Versuche++;
if (Eingabe+1 == ZahlFix|| Eingabe - 1 == ZahlFix)
{
cout << "Falsch! Heiss!" << endl << endl;
}
else if (Eingabe+2 == ZahlFix || Eingabe - 2 == ZahlFix)
{
cout << "Falsch! Warm!" << endl << endl;
}
else if (Eingabe == ZahlFix)
{
time(&final);
seconds = difftime(final, now);
cout << endl << "Genau ! Zeit: " << seconds << " sekunden" << endl << "Versuche: " << Versuche << endl;
}
else
{
cout << "Falsch! Kalt!" << endl << endl;
}
} while (Eingabe != ZahlFix);
}
else
{
cout << "Wahlen Sie ein Zahl zwichen 1 und 10!"<<endl;
}
}