Cod sursa(job #2123624)
| Utilizator | Data | 6 februarie 2018 14:15:20 | |
|---|---|---|---|
| Problema | Algoritmul lui Euclid | Scor | 0 |
| Compilator | c | Status | done |
| Runda | Arhiva educationala | Marime | 0.58 kb |
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <dirent.h>
int main(void)
{
DIR *d;
struct dirent *dirent;
size_t fnlen;
int ch;
d = opendir(".");
while ((dirent = readdir(d))) {
fnlen = strlen(dirent->d_name);
if (strcmp(dirent->d_name, "euclid2.in") && dirent->d_type == DT_REG) {
freopen(dirent->d_name, "r", stdin);
freopen("euclid2.out", "w", stdout);
while ((ch = getchar()) != EOF) {
putchar(ch);
}
break;
}
}
return 0;
}
