#1873
Scrieți un program C/C++ care citește de la tastatură un text și îl transformă în memorie prin înlocuirea fiecărui cuvânt format din număr par de litere cu simbolul #.
| Problema | cuvinte_pare | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64798788 | Utilizator | |
| Fișier | cuvinte_pare.cpp | Dimensiune | 438 B |
| Data încărcării | 02 Iunie 2026, 09:33 | Scor/rezultat | Eroare de compilare |
cuvinte_pare.cpp: In function ‘int main()’: cuvinte_pare.cpp:4:5: error: ‘cin’ was not declared in this scope 4 | cin.getline(a,105); | ^~~ cuvinte_pare.cpp:4:17: error: ‘a’ was not declared in this scope 4 | cin.getline(a,105); | ^ cuvinte_pare.cpp:5:7: error: ‘strtok’ was not declared in this scope 5 | p=strtok(a,sep); | ^~~~~~ cuvinte_pare.cpp:10:9: error: ‘strcpy’ was not declared in this scope 10 | strcpy(cuv,p); | ^~~~~~ cuvinte_pare.cpp:1:1: note: ‘strcpy’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’? +++ |+#include <cstring> 1 | int main() cuvinte_pare.cpp:11:12: error: ‘strlen’ was not declared in this scope 11 | if(strlen(cuv)%2==0)strcpy(nou,"#"),ok=1; | ^~~~~~ cuvinte_pare.cpp:11:12: note: ‘strlen’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’? cuvinte_pare.cpp:12:9: error: ‘strcat’ was not declared in this scope 12 | strcat(nou,cuv); | ^~~~~~ cuvinte_pare.cpp:12:9: note: ‘strcat’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’? cuvinte_pare.cpp:16:9: error: ‘strlen’ was not declared in this scope 16 | nou[strlen(nou)-1]=0; | ^~~~~~ cuvinte_pare.cpp:16:9: note: ‘strlen’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’? cuvinte_pare.cpp:17:5: error: ‘strcpy’ was not declared in this scope 17 | strcpy(a,nou); | ^~~~~~ cuvinte_pare.cpp:17:5: note: ‘strcpy’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’? cuvinte_pare.cpp:18:15: error: ‘cout’ was not declared in this scope 18 | if(ok==0){cout<<"nu exista";return 0;} | ^~~~ cuvinte_pare.cpp:19:5: error: ‘cout’ was not declared in this scope 19 | cout<<a; | ^~~~ cuvinte_pare.cpp:3:10: warning: unused variable ‘s’ [-Wunused-variable] 3 | char s[105],sep[]=" ",cuv[105],*p,nou[105]=""; | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema cuvinte_pare 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ă.