#4763
Într-un text, de cel mult 100 de caractere, cuvintele sunt formate din litere ale alfabetului englez și sunt separate prin spații. Scrieți un program C/C++ care citește de la tastatură un text de tipul precizat mai sus și afișează pe ecran mesajul DA și un număr natural n, separate printr-un spațiu, dacă toate cuvintele din text au câte n litere, sau mesajul NU în cazul în care nu toate cuvintele au același număr de litere.
Bacalaureat 2024
| Problema | CuvinteLungimiEgale | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 8 MB
/
Stivă 2 MB
|
| Id soluție | #62991852 | Utilizator | |
| Fișier | cuvintelungimiegale.c | Dimensiune | 403 B |
| Data încărcării | 09 Februarie 2026, 20:40 | Scor/rezultat | Eroare de compilare |
cuvintelungimiegale.c:3:20: warning: initialization makes integer from pointer without a cast [enabled by default] char s[251],*p,sep=" "; ^ cuvintelungimiegale.c:3:1: error: initializer element is not computable at load time char s[251],*p,sep=" "; ^ cuvintelungimiegale.c: In function 'main': cuvintelungimiegale.c:7:5: warning: 'gets' is deprecated (declared at /usr/include/i386-linux-gnu/bits/stdio2.h:233) [-Wdeprecated-declarations] gets(s); ^ cuvintelungimiegale.c:8:5: warning: passing argument 2 of 'strtok' makes pointer from integer without a cast [enabled by default] p=strtok(s,' '); ^ In file included from cuvintelungimiegale.c:2:0: /usr/include/string.h:348:14: note: expected 'const char * restrict' but argument is of type 'int' extern char *strtok (char *__restrict __s, const char *__restrict __delim) ^ cuvintelungimiegale.c:10:5: warning: passing argument 2 of 'strtok' makes pointer from integer without a cast [enabled by default] p=strtok(NULL,' '); ^ In file included from cuvintelungimiegale.c:2:0: /usr/include/string.h:348:14: note: expected 'const char * restrict' but argument is of type 'int' extern char *strtok (char *__restrict __s, const char *__restrict __delim) ^ cuvintelungimiegale.c:19:10: warning: passing argument 2 of 'strtok' makes pointer from integer without a cast [enabled by default] p=strtok(NULL,' '); ^ In file included from cuvintelungimiegale.c:2:0: /usr/include/string.h:348:14: note: expected 'const char * restrict' but argument is of type 'int' extern char *strtok (char *__restrict __s, const char *__restrict __delim) ^ cuvintelungimiegale.c:22:12: error: expected expression before '%' token printf(%d,n); ^ cuvintelungimiegale.c:7:9: warning: ignoring return value of 'gets', declared with attribute warn_unused_result [-Wunused-result] gets(s); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema CuvinteLungimiEgale 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ă.