du3
This commit is contained in:
parent
9044d3fb0c
commit
3b6dc85ef5
BIN
du3/program
Executable file
BIN
du3/program
Executable file
Binary file not shown.
32
du3/program.c
Normal file
32
du3/program.c
Normal file
@ -0,0 +1,32 @@
|
||||
#define __USE_XOPEN
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include<stdio.h>
|
||||
#include<time.h>
|
||||
#include<stdlib.h>
|
||||
|
||||
int main() {
|
||||
char buffer[20];
|
||||
struct tm tm;
|
||||
|
||||
char *retval = fgets(buffer, sizeof(buffer), stdin);
|
||||
|
||||
if (retval == 0) {
|
||||
puts("Neplatny datum");
|
||||
return 0;
|
||||
}
|
||||
|
||||
retval = strptime(buffer, "%e.%m.%-Y", &tm);
|
||||
|
||||
if (retval == 0) {
|
||||
puts("Neplatny datum");
|
||||
return 0;
|
||||
}
|
||||
|
||||
tm.tm_mday += 7;
|
||||
|
||||
strftime(buffer, sizeof(buffer), "%e.%m.%-Y", &tm);
|
||||
puts(buffer);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user