#12
Să se scrie un program care citeşte de la tastatură o propoziţie formată din mai multe cuvinte separate prin spaţii şi transformă prima şi ultima literă a fiecărui cuvânt în literă mare.
Variante Bacalaureat 2009
| Problema | Initiale | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64800893 | Utilizator | |
| Fișier | initiale.cpp | Dimensiune | 628 B |
| Data încărcării | 02 Iunie 2026, 10:55 | Scor/rezultat | Eroare de compilare |
initiale.cpp: In function ‘int main()’: initiale.cpp:11:12: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 11 | if(strchr("a",p[strlen(p)]) | ^~~~~~ initiale.cpp:11:36: error: expected ‘;’ before ‘p’ 11 | if(strchr("a",p[strlen(p)]) | ^ | ; 12 | p[strlen(p)="A"]; | ~ initiale.cpp:11:18: warning: statement has no effect [-Wunused-value] 11 | if(strchr("a",p[strlen(p)]) | ~~~~~~^~~~~~~~~~~~~~~~~~ initiale.cpp:14:9: error: expected primary-expression before ‘if’ 14 | if(strchr("e",p[strlen(p)]) | ^~ initiale.cpp:12:30: error: expected ‘)’ before ‘if’ 12 | p[strlen(p)="A"]; | ^ | ) 13 | 14 | if(strchr("e",p[strlen(p)]) | ~~ initiale.cpp:11:11: note: to match this ‘(’ 11 | if(strchr("a",p[strlen(p)]) | ^ initiale.cpp:17:12: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 17 | if(strchr("i",p[strlen(p)]) | ^~~~~~ initiale.cpp:17:36: error: expected ‘;’ before ‘p’ 17 | if(strchr("i",p[strlen(p)]) | ^ | ; 18 | p[strlen(p)="I"]; | ~ initiale.cpp:17:18: warning: statement has no effect [-Wunused-value] 17 | if(strchr("i",p[strlen(p)]) | ~~~~~~^~~~~~~~~~~~~~~~~~ initiale.cpp:20:9: error: expected primary-expression before ‘if’ 20 | if(strchr("o",p[strlen(p)]) | ^~ initiale.cpp:18:30: error: expected ‘)’ before ‘if’ 18 | p[strlen(p)="I"]; | ^ | ) 19 | 20 | if(strchr("o",p[strlen(p)]) | ~~ initiale.cpp:17:11: note: to match this ‘(’ 17 | if(strchr("i",p[strlen(p)]) | ^ initiale.cpp:23:12: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions] 23 | if(strchr("u",p[strlen(p)]) | ^~~~~~ initiale.cpp:23:36: error: expected ‘;’ before ‘p’ 23 | if(strchr("u",p[strlen(p)]) | ^ | ; 24 | p[strlen(p)="U"]; | ~ initiale.cpp:23:18: warning: statement has no effect [-Wunused-value] 23 | if(strchr("u",p[strlen(p)]) | ~~~~~~^~~~~~~~~~~~~~~~~~ initiale.cpp:25:23: error: expected ‘)’ before ‘;’ token 25 | p=strtok(NULL," "); | ^ | ) initiale.cpp:23:11: note: to match this ‘(’ 23 | if(strchr("u",p[strlen(p)]) | ^ initiale.cpp:25:6: warning: suggest parentheses around assignment used as truth value [-Wparentheses] 25 | p=strtok(NULL," "); | ~^~~~~~~~~~~~~~~~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Initiale 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ă.