Cov txheej txheem:
- Kauj Ruam 1: Kauj Ruam 1:
- Kauj Ruam 2: Kauj Ruam 2: Sau Peb Txoj Cai thiab Kawm Yam Tshiab
- Kauj Ruam 3: Kauj Ruam 3: Peb Ruaj Siab Peb Lub Sijhawm Kom Hla Dua Qhov Teeb Meem
- Kauj Ruam 4: Kauj Ruam 4:
Video: Clock Yooj Yim Hauv Hom Lus C: 4 Cov Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:27
Lub Tswv Yim yog los tsim lub moos yooj yim hauv C, tab sis ua ntej peb yuav tsum teeb tsa peb cov software thiab paub txog qee yam uas peb yuav siv.
Kauj Ruam 1: Kauj Ruam 1:
- Xaiv Visual Studio, Code Blocks lossis lwm yam software zoo sib xws (kuv xav kom pom qhov muag pom studio 2015).
- Kuv yuav siv Visual Studio 2015, yog li ntaus hauv google "Visual Studio 2015 Community", rub tawm thiab teeb tsa.
- Tom qab teeb tsa, khiav Visual Studio, nias Tshiab/Project/Console Application.
- Hauv Console Application Wizard nias tom ntej, tom qab ntawd xaiv tsis tau Precompiled header thiab xaiv Empty project, ces Finish.
- Ntawm koj sab xis koj yuav muaj Solution Explorer, nyem rau ntawm Cov Ntaub Ntawv Ntxiv, Ntxiv/Cov Khoom Tshiab/C ++ cov ntaub ntawv (.cpp), tab sis hloov lub npe rau Source.c thiab ntxiv.
- Tam sim no koj muaj C phiaj xwm npaj pib.
Kauj Ruam 2: Kauj Ruam 2: Sau Peb Txoj Cai thiab Kawm Yam Tshiab
Nov yog peb tus lej:
#suav nrog#suav nrog // peb suav nrog cov ntawv Windows (nws txuas nrog rau kev ua haujlwm pw tsaug zog ()), uas txhais tau tias qhov no tsuas yog ua haujlwm rau lub qhov rais, yog li yog tias koj siv lwm OS, tshawb hauv google rau lwm yam kev pw tsaug zog ().
int lub ntsiab ()
{
tus, h, m; s. // peb ntxiv cov teev, feeb thiab vib nas this rau peb qhov program
int D = 1000; // peb ntxiv Kev ncua ntawm 1000 milliseconds, uas ua rau thib ob thiab peb yuav siv qhov ntawd hauv kev tsaug zog ().
printf ("Teem sijhawm: / n"); // printf sau rau ntawm cov ntawv screen uas yog sab hauv ("") thiab / n sau ua kab tshiab.
scanf (" %d %d %d", & h, & m, & s); // scanf yog qhov uas peb ntxig peb lub sijhawm, lossis peb qhov tseem ceeb.
yog (h> 12) {printf ("YOOJ YIM! / n"); tawm (0); } // hauv qhov no yog kev ua haujlwm peb tshuaj xyuas yog tias tus nqi nkag tau loj dua 12.
yog (m> 60) {printf ("YOOJ YIM! / n"); tawm (0); } // zoo ib yam ntawm no thiab yog tias nws loj dua, qhov program sau ERROR! thiab tawm mus
yog (s> 60) {printf ("YOOJ YIM! / n"); tawm (0); } // zoo sib xws
thaum (1) // thaum (1) yog lub voj infinity thiab txhua yam hauv rov ua nws tus kheej rau infinity. {
s += 1; // qhov no qhia txoj haujlwm kom nce vib nas this rau 1, txhua lub sijhawm thaum lub sijhawm los txog rau ntu no.
yog (s> 59) {m += 1; s = 0; } // yog tias cov vib nas this ntau dua 59, nws nce cov feeb thiab teev vib nas this rau 0.
yog (m> 59) {h += 1; m = 0; } // zoo sib xws
yog (h> 12) {h = 1; m = 0; s = 0; } // zoo sib xws
printf ("\ n Lub moos");
printf ("\ n%02d:%02d:%02d", h, m, s); // qhov no sau peb lub sijhawm hauv hom ntawv no "00:00:00"
Pw tsaug zog (D); // qhov no yog peb txoj haujlwm pw tsaug zog uas ua rau qeeb lub sijhawm thiab ua rau nws zoo li lub moos.
system ("kws"); // qhov no tshem tawm qhov screen.
}
tau txais (); rov 0;
}
*Txhua yam tom qab '//' yog cov lus tawm tswv yim thiab tsis hloov pauv txoj haujlwm, yog li nws tuaj yeem tshem tawm.
** Visual Studio qee zaum yuav tsis ua haujlwm vim nws muaj "scanf", yog li koj yuav tsum mus rau Kev Tshawb Fawb Explorer> nyem rau ntawm qhov chaw> Cov Khoom (Ib yam li hauv daim duab yuav tsum tshwm sim)> hauv kev teeb tsa xaiv Txhua Qhov Kev Tsim Kho > Cov cuab yeej teeb tsa> C/C ++> Preprocessor> hauv Preprocessor Cov Lus Txhais sau _CRT_SECURE_NO_WARNINGS> Txuag.
Kauj Ruam 3: Kauj Ruam 3: Peb Ruaj Siab Peb Lub Sijhawm Kom Hla Dua Qhov Teeb Meem
- Insert random numbers, kom h yog> 12, m yog> 60, s yog> 60.
- Txoj haujlwm sau ERROR! thiab tawm mus.
- Txog tam sim no vam meej!
Kauj Ruam 4: Kauj Ruam 4:
- Ntxig cov lej tsis raug, yog li h yog <12, m yog <60, s yog <60.
- cov lej hloov mus rau 00:00:00 hom ntawv thiab lub moos pib "zuam".
- SUCCESS tseeb.
*Tom qab lub moos dhau 12, 'teev' hloov mus rau 01 thiab 'feeb' thiab 'vib nas this' txog 00.
Muaj kev lom zem!
Pom zoo:
D.I.Y YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM LOS NTAWM SCRAPS: 4 Cov Kauj Ruam (nrog Duab)
D.I.Y YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM LOS NTAWM SCRAPS: Hnub no kuv xav qhia yuav ua li cas kom pom lub teeb pom kev zoo los ntawm lub zog xa hluav taws xob tsis siv hluav taws xob los ntawm tus txhuam txhuam hniav thiab lub tshuab solenoid valve coils uas tau khaws los ntawm scrapyard.Ua ntej pib, thov saib cov vis dis aus hauv qab no:
Kev Ceeb Toom Hluav Taws Xob Siv Arduino [Hauv Qhov Yooj Yim Yooj Yim Yooj Yim]: 3 Kauj Ruam
Kev Ceeb Toom Hluav Taws Xob Siv Arduino [Hauv Ob Qes Yooj Yim Yooj Yim]: Puas yog koj tab tom nrhiav kom ua txoj haujlwm yooj yim thiab nthuav nrog Arduino uas nyob rau tib lub sijhawm tuaj yeem muaj txiaj ntsig tiag tiag thiab muaj peev xwm cawm txoj sia? tej yam tshiab thiab tshiab. Hauv kab ntawv no peb mus
Txoj Kev Yooj Yim thiab Yooj Yim Los Hloov Koj Lub Xauv Screen hauv 6 Cov Kauj Ruam Yooj Yim (Windows 8-10): 7 Kauj Ruam
Txoj Kev Yooj Yim thiab Yooj Yim Los Hloov Koj Lub Xauv Screen hauv 6 Cov Kauj Ruam Yooj Yim (Windows 8-10): Xav hloov pauv yam ntawm koj lub laptop lossis PC? Xav tau kev hloov pauv hauv koj qhov chaw? Ua raws cov kauj ruam no yooj yim thiab yooj yim kom ua tiav koj tus kheej lub computer ntsuas phoo
YUAV UA LI CAS YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM TSHAJ PLAWS YOOJ YIM: 4 Cov Kauj Ruam
YUAV UA LI CAS YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM YOOJ YIM TSHAJ PLAWS: Nyob zoo txhua tus hauv cov lus qhia no kuv yuav qhia koj yuav ua li cas kom yooj yim " SOIL DRYNESS SENSOR ". Qhuav ntawm cov av tau txheeb xyuas siv qhov taw qhia coj. Lub teeb ci wi
Ib qho yooj yim heev/yooj yim/Tsis yooj yim txoj hauv kev kom tib neeg/tib neeg/tsiaj/neeg hlau zoo li lawv muaj txias tiag tiag/Lub zeem muag tshav kub kub (Xim ntawm Koj Xaiv) Siv GIMP: 4 Cov Kauj Ruam
Ib qho yooj yim heev/yooj yim/Tsis yooj yim txoj hauv kev kom tib neeg/tib neeg/tsiaj/neeg hlau zoo li lawv muaj txias tiag tiag/Lub zeem muag tshav kub kub (Xim ntawm Koj Xaiv) Siv GIMP: Nyeem … lub npe