Zeitfunktionen
This commit is contained in:
@@ -2,6 +2,9 @@
|
||||
|
||||
#define FUNKTIONEN_H
|
||||
|
||||
#include<time.h>
|
||||
|
||||
|
||||
int mult(int a, int b) {
|
||||
return a * b;
|
||||
}
|
||||
@@ -10,4 +13,12 @@ int add(int a, int b) {
|
||||
return a + b;
|
||||
}
|
||||
|
||||
void printTime(){
|
||||
time_t now;
|
||||
time(&now);
|
||||
struct tm *myTm;
|
||||
myTm = localtime(&now);
|
||||
printf("%02d:%02d:%02d Uhr\n", myTm->tm_hour, myTm->tm_min, myTm->tm_sec);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#include "funktionen.h"
|
||||
|
||||
int main() {
|
||||
printf("Produkt: %d\n", mult(4, 5));
|
||||
printf("Summe: %d\n", add(4, 5));
|
||||
printTime();
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user