#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 | #64799180 | Utilizator | |
| Fișier | cuvinte_pare.cpp | Dimensiune | 461 B |
| Data încărcării | 02 Iunie 2026, 09:44 | Scor/rezultat | Eroare de compilare |
cuvinte_pare.cpp: In function ‘void transf(char*)’: cuvinte_pare.cpp:4:14: error: expected unqualified-id before ‘char’ 4 | char *p, char sep[]=" ". char cuv[N][N]; | ^~~~ cuvinte_pare.cpp:5:17: error: ‘sep’ was not declared in this scope 5 | p=strtok(p, sep); | ^~~ cuvinte_pare.cpp:5:7: error: ‘strtok’ was not declared in this scope 5 | p=strtok(p, sep); | ^~~~~~ cuvinte_pare.cpp:8:16: error: ‘cuv’ was not declared in this scope 8 | strcpy(cuv[cnt++], p); | ^~~ cuvinte_pare.cpp:8:9: error: ‘strcpy’ was not declared in this scope 8 | strcpy(cuv[cnt++], p); | ^~~~~~ cuvinte_pare.cpp:1:1: note: ‘strcpy’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’? +++ |+#include <cstring> 1 | void transf(char s[]) cuvinte_pare.cpp:14:19: error: ‘cuv’ was not declared in this scope 14 | if(strlen(cuv)%2==0) strcat(nou, "#"); | ^~~ cuvinte_pare.cpp:14:12: error: ‘strlen’ was not declared in this scope 14 | if(strlen(cuv)%2==0) strcat(nou, "#"); | ^~~~~~ cuvinte_pare.cpp:14:12: note: ‘strlen’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’? cuvinte_pare.cpp:14:37: error: ‘nou’ was not declared in this scope 14 | if(strlen(cuv)%2==0) strcat(nou, "#"); | ^~~ cuvinte_pare.cpp:14:30: error: ‘strcat’ was not declared in this scope 14 | if(strlen(cuv)%2==0) strcat(nou, "#"); | ^~~~~~ cuvinte_pare.cpp:14:30: note: ‘strcat’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’? cuvinte_pare.cpp:17:24: error: ‘nou’ was not declared in this scope 17 | strcat(nou, " "); | ^~~ cuvinte_pare.cpp:17:17: error: ‘strcat’ was not declared in this scope 17 | strcat(nou, " "); | ^~~~~~ cuvinte_pare.cpp:17:17: note: ‘strcat’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’? cuvinte_pare.cpp:22:5: error: ‘nou’ was not declared in this scope 22 | nou[strlen(nou)-1]=0; | ^~~ cuvinte_pare.cpp:22:9: error: ‘strlen’ was not declared in this scope 22 | nou[strlen(nou)-1]=0; | ^~~~~~ cuvinte_pare.cpp:22:9: note: ‘strlen’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’? cuvinte_pare.cpp:23:5: error: ‘strcpy’ was not declared in this scope 23 | strcpy(s, nou); | ^~~~~~ cuvinte_pare.cpp:23:5: note: ‘strcpy’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’?
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ă.