Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Geburtstagsprogramm

Empfohlene Antworten

Veröffentlicht

Ich muss ein Progaramm programmieren das ein eingelesenes Datum mit dem aktuellen Datum vergleicht und wenn das eingelesene Datum mit dem aktuellen Datum Übereinstimmt, soll eine Meldung erscheinen: "Hat heute Geburtstag!"

Ich kenne allerdings die Funktion mit der ich das aktuelle Datum ermitteln kann nicht.

Falls es so eine überhaupt gibt. und wenn ja wie muss ich das Datum eingeben wenn ich es mit dem aktuellen vergleichen möchte? xx.xx.xx oder xx.xx.xxxx oder ect?

Hope for Help

:confused:

Hier mein Beispiel:

#include <iostream>

#include <ctime>

using namespace std;


class Zeit {

	int t,m;

	time_t sec;

	tm* zt;

public:

	Zeit(void);

	bool istheute(int Tag, int Monat);

};

Zeit::Zeit()

{

	time(&sec);

	zt = localtime(&sec);

	t = zt->tm_mday, m = zt->tm_mon;

	m += 1;

}

bool Zeit::istheute(int Tag, int Monat)

{

	if (t == Tag && m == Monat)

		return true;

	return false;

}


int main(void) {

	Zeit Geburtstag; //Objekt anlegen

	int t,m; //locale Variablen


	cout << "Bitte Tag eingeben: "; cin >> t;

	cout << "Bitte Monat eingeben: "; cin >> m;


	if (Geburtstag.istheute(t,m))

		cout << "Hat heute Geburtstag! :)" <<  endl;

	else

		cout << "Hat kein Geburtstag :(" << endl;


	return 0;

}

thx hat mir sehr geholfen :)

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.