Git
- 7 ответов
- 0 вопросов
3
Вклад в тег
git checkout master
git commit-tree -p master -p feature -m "Overriding master with feature" feature^{tree}
12346aa23590aa
git merge --ff 12346aa23590aa
make CC=cross-gcc HOST_CC=gcc
#include <stdio.h>
#include <string.h>
#define MAX_NUM_LENGTH 100
const char* chose(const char* left, const char* right)
{
const size_t len_left = strlen(left);
const size_t len_right = strlen(right);
if (len_left > len_right)
return left;
if (len_right > len_left)
return right;
if (strcmp(left, right) < 0)
return right;
return left;
}
const char* get_max(const char* n1, const char* n2, const char* n3)
{
return
chose(
chose(n1, n2),
chose(n2, n3));
}
int main()
{
FILE* in = NULL;
FILE* out = NULL;
char n1[MAX_NUM_LENGTH + 1];
char n2[MAX_NUM_LENGTH + 1];
char n3[MAX_NUM_LENGTH + 1];
in = fopen("input.txt", "r");
if (!in) {
perror("Cannot open file 'input.txt'");
return 1;
}
if (3 != fscanf(in, "%100[0-9] %100[0-9] %100[0-9]", n1, n2, n3)) {
perror("Wrong input format");
fclose(in);
return 1;
}
const char* max_num = get_max(n1, n2, n3);
out = fopen("output.txt", "w");
if (!out) {
perror("Cannot open file 'output.txt'");
return 1;
}
fprintf(out, "%s", max_num);
fclose(in);
fclose(out);
return 0;
}