Osaisiko joku neuvoa miten tehdään c :ssalla lyhyt ohjelma joka ajastaa
5sec --> teksti 1
4sec --> teksti 2
3sec --> teksti 3
2sec --> teksti 4
1sec --> teksti 5
0sec --> exit
C++ ajastettu tekstin tulostus
4
477
Vastaukset
- tyyyty
Tästäpä lähtökohta
#include- tyyty
#include stdio.h
#include time.h
#include conio.h
int main( )
{
char dateStr [9];
char timeStr [9];
_strdate( dateStr);
printf( "The current date is %s \n", dateStr);
_strtime( timeStr );
printf( "The current time is %s \n", timeStr);
getche();
return 0;
} - tyyty
tyyty kirjoitti:
#include stdio.h
#include time.h
#include conio.h
int main( )
{
char dateStr [9];
char timeStr [9];
_strdate( dateStr);
printf( "The current date is %s \n", dateStr);
_strtime( timeStr );
printf( "The current time is %s \n", timeStr);
getche();
return 0;
}Tällainen on myös nahdollinen
typedef struct _SYSTEMTIME {
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME; - vaik näin
tyyty kirjoitti:
Tällainen on myös nahdollinen
typedef struct _SYSTEMTIME {
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME;#include Windows.h
#include stdio.h
#include conio.h
int main(void)
{
SYSTEMTIME st;
GetSystemTime(&st);
int start_second=st.wSecond;
printf("%d", start_second);
//printf("Year:%d\nMonth:%d\nDate:%d\nHour:%d\nMin:%d\nSecond:% d\n" ,st.wYear,st.wMonth,st.wDay,st.wHour,st.wMinute,st.wSecond);
while(1)
{
GetSystemTime(&st);
int present_second=st.wSecond;
if(present_second==start_second 3)
{
printf("One mennyt kolme sekuntia. ");
}
}
getche();
return 0;
}
Ketjusta on poistettu 0 sääntöjenvastaista viestiä.
Luetuimmat keskustelut
- 73883
Miltä se tuntuu
Miltä se tuntuu havahtua, että on ollut ihmistä kohtaan, joka on rakastanut ja varjellut, täysi m*lkku? Vai havahtuuko s104748- 43631
- 36623
- 47613
- 30601
- 40595
- 50560
Mitä se olisi
Jos sinä mies saisit sanoa kaivatullesi mitä vain juuri nyt. Ilman mitään seuraamuksia yms. Niin mitä sanoisit?34557- 37496