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.

Empfohlene Antworten

Veröffentlicht

Hi zusammen

ich brauch eine Funktion die mir den Vortrag berechnet indem ich ein beliebiges Datum übergebe.

int vortag(int tag, int monat, int jahr)

{

//Anweisungen

return vortag_wert;

}

als return würde z.B. für den 14-04-2010 der wert 20100414 zurückgegeben.

Gibt es irgendeine Funktion in time.h die zumindenst den Vortag errechnet und Schaltjahre & Monatslänge berücksichtigt?

Hab leider bisher nichts zu meinem Problem gefunden : /

Bin für alle hinweise dankbar : )

Danke im vorraus für eure Hilfe!

Ich denk zu kompliziert ^^

	

#include <time.h>

class zeit

	{

	private:

		int monat;

		int tag;

		int tag_woche;

		int jahr;

	public:

		void set_all();

		int give_days_after_sunday();

		int give_day();

		int give_month();

		int give_year();

	};



	void zeit::set_all()

	{

	  struct tm *time_val;

	  time_t unix_time;

	  unix_time = time(NULL)-(24*3600); //<-- Tag abziehn?

	  time_val = localtime(&unix_time);

	  if (time_val != NULL)

	  {

		 monat=time_val->tm_mon + 1;

		 tag=time_val->tm_mday;

		 jahr=time_val->tm_year + 1900;

		 tag_woche = time_val->tm_wday;

	  }

	}


	int zeit::give_days_after_sunday(){return tag_woche;}

	int zeit::give_day(){return tag;}

	int zeit::give_month(){return monat;}

	int zeit::give_year(){return jahr;}

so sollte es richtig sein oder?

Erstelle ein Konto oder melde dich an, um einen Kommentar zu schreiben.

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.