#1
Să se scrie un program care citeşte din fişier două numere întregi şi determină suma lor.
| Problema | sum | Operații I/O |
sum.in/sum.out
|
|---|---|---|---|
| Limita timp | 1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64948286 | Utilizator | |
| Fișier | sum.c | Dimensiune | 198 B |
| Data încărcării | 21 Iunie 2026, 02:33 | Scor/rezultat | Eroare de compilare |
sum.c: In function ‘main’: sum.c:4:17: warning: passing argument 1 of ‘freopen’ from incompatible pointer type [-Wincompatible-pointer-types] 4 | freopen(stdin, "sum.in", "r"); | ^~~~~ | | | FILE * In file included from sum.c:1: /usr/include/stdio.h:271:46: note: expected ‘const char * restrict’ but argument is of type ‘FILE *’ 271 | extern FILE *freopen (const char *__restrict __filename, | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~ sum.c:4:34: warning: passing argument 3 of ‘freopen’ from incompatible pointer type [-Wincompatible-pointer-types] 4 | freopen(stdin, "sum.in", "r"); | ^~~ | | | char * /usr/include/stdio.h:273:40: note: expected ‘FILE * restrict’ but argument is of type ‘char *’ 273 | FILE *__restrict __stream) __wur __nonnull ((3)); | ~~~~~~~~~~~~~~~~~^~~~~~~~ sum.c:5:13: warning: passing argument 1 of ‘freopen’ from incompatible pointer type [-Wincompatible-pointer-types] 5 | freopen(stdout, "sum.out" "w"); | ^~~~~~ | | | FILE * /usr/include/stdio.h:271:46: note: expected ‘const char * restrict’ but argument is of type ‘FILE *’ 271 | extern FILE *freopen (const char *__restrict __filename, | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~ sum.c:5:5: error: too few arguments to function ‘freopen’ 5 | freopen(stdout, "sum.out" "w"); | ^~~~~~~ /usr/include/stdio.h:271:14: note: declared here 271 | extern FILE *freopen (const char *__restrict __filename, | ^~~~~~~ sum.c:9:5: warning: implicit declaration of function ‘print’; did you mean ‘printf’? [-Wimplicit-function-declaration] 9 | print("%d\n", a+b); | ^~~~~ | printf sum.c:4:9: warning: ignoring return value of ‘freopen’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 4 | freopen(stdin, "sum.in", "r"); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sum.c:8:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | scanf("%d%d", &a, &b); | ^~~~~~~~~~~~~~~~~~~~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema sum face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:
Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.