DayOfTheWeek Problem
-
Hallo
und wenn du auf deiner Platte suchst wirst du auch keine "DateUtils" finden
nur eine "DateUtils.hpp"MfG
Klaus
-
Danke schonmal für die Hilfe. Ich bin halt ein Anfänger, desdhalb braüchte ich mal eure Hilfe. Könntet ihr mir wohl mal sagen was da alles für Fehgler drin sind???
string datum, dayl;
int day;datum = date();
day = DayOfTheWeek(datum);switch(day)
{
case 1: dayl = "Mo"; break;
case 2: dayl = "Di"; break;
case 3: dayl = "Mi"; break;
case 4: dayl = "Do"; break;
case 5: dayl = "Fr"; break;
case 6: dayl = "Sa"; break;
case 7: dayl = "So"; break;
}MfG
Muecke
-
Bitte Code Tags verwenden...
Was funktioniert denn nicht? Was ist date()?
-
Sorry, dass ich euch mit so kleinigkeiuten nerve, aber hier mal der Code. Jetzt ist der Fehlerfrei aber ich bekomme einen Linkerfehler. Hier soll ersteinmal nur was ausgegeben werden, zum prüfen ob das auch funktioniert.
#pragma hdrstop #include <stdio> #include <conio> #include <stdlib> #include <iostream> #include <string> #include <time> #include <system.hpp> #include <DateUtils.hpp> #include <SysUtils.hpp> using namespace std;#pragma argsused int main() { string datum, dayl; int day; //datum = Date; day = DayOfTheWeek(TDateTime()); switch(day) { case 1: dayl = "Mo"; break; case 2: dayl = "Di"; break; case 3: dayl = "Mi"; break; case 4: dayl = "Do"; break; case 5: dayl = "Fr"; break; case 6: dayl = "Sa"; break; case 7: dayl = "So"; break; } cout << dayl; getch(); }Ich weiß einfach nicht weiter. Bitte helft mir.
MfG
Muecke
-
Hallo
du vermischt Standard-C++ mit den Borland-Erweiterungen, insbesondere string und (Ansi)String.
Hast du das Konsolenprogramm mit VCL-Unterstützung erstellt? Dann must du string durch AnsiString ersetzen.bis bald
akari
-
Muecke schrieb:
#pragma hdrstop #include <stdio> #include <conio> #include <stdlib> #include <iostream> #include <string> #include <time> #include <system.hpp> #include <DateUtils.hpp> #include <SysUtils.hpp> using namespace std;hier fehlt noch <wtf>
-
ROTFL!!!!
-
Hi
#include <iostream> #include <dateutils.hpp> using namespace std; int main(){ switch(DayOfTheWeek(Now())){ case 1: cout<<"Mo"<<endl; break; case 2: cout<<"Di"<<endl; break; case 3: cout<<"Mi"<<endl; break; case 4: cout<<"Do"<<endl; break; case 5: cout<<"Fr"<<endl; break; case 6: cout<<"Sa"<<endl; break; case 7: cout<<"So"<<endl; break; default: cout<<"i didnt mean to do that.. "<<endl; } }sollte gehen... wenns denn unbedingt mischmash sein soll
-
Muecke schrieb:
...Habe mir die Hilfe über die Funktion DayOfTheWeek durchgelesen
... und dann lies sie nochmal, damit die Zuordnung zwischen den Zeichenketten und der Rückgabe von DayOfWeek auch stimmt.
-
auf Konsolenebene ohne VCL:
#include <conio.h> #include <iostream.h> #include <time.h> int main(int argc, char* argv[]) { time_t timer=time(NULL);; struct tm *tblock=localtime(&timer); string wochentage[7]={"Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"}; cout << wochentage[int(tblock->tm_wday)]; getch(); return 0; }