#4756
Se citește un text format din cuvinte și separatori. Cuvintele sunt formate din litere mici ale alfabetului, iar separatorii sunt spațiul, plus caracterele din șirul '.,!?:;-.
1) Să se afișeze n – numărul de cuvinte, precum și cuvintele din text.
2) Se se afișeze cuvântul cel mai mic din punct de vedere lexicografic.
3) Să se determine numărul de cuvinte care conțin secvența ini.
4) Să se afișeze fiecare cuvânt oglindit.
5) Să se determine câte cuvinte se termină cu litera a.
6) Să se determine lungimea minimă și lungimea maximă a unui cuvânt
| Problema | textcuv | Operații I/O |
textcuv.in/textcuv.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 16 MB
/
Stivă 8 MB
|
| Id soluție | #63504613 | Utilizator | |
| Fișier | textcuv.cpp | Dimensiune | 1.78 KB |
| Data încărcării | 06 Martie 2026, 08:50 | Scor/rezultat | Eroare de compilare |
textcuv.cpp:58:28: warning: missing terminating ' character [enabled by default] if(cuv[i][k-1]=='a) ^ textcuv.cpp:58:12: error: missing terminating ' character if(cuv[i][k-1]=='a) ^ textcuv.cpp:4:13: error: variable 'std::ifstream fin' has initializer but incomplete type ifstream fin("textcuv.in") ^ textcuv.cpp:5:1: error: expected ',' or ';' before 'ofstream' ofstream fout("textcuv.out"); ^ textcuv.cpp: In function 'int main()': textcuv.cpp:11:5: error: expected initializer before '>>' token fin>>T; ^ textcuv.cpp:13:15: error: expected ')' before numeric constant fin.getline(s.1001); ^ textcuv.cpp:15:9: error: expected ')' before '!' token while(p!NULL) ^ textcuv.cpp:15:14: error: expected ';' before ')' token while(p!NULL) ^ textcuv.cpp:19:2: warning: statement has no effect [-Wunused-value] } ^ textcuv.cpp:21:3: error: 'fout' was not declared in this scope {fout<<n<<'\n'; ^ textcuv.cpp:31:10: error: expected ')' before 'strcpy' strcpy(cuvmin,cuv[i]); ^ textcuv.cpp:32:10: error: 'fout' was not declared in this scope fout<<cuvmin<<'\n'; ^ textcuv.cpp:37:22: error: expected ',' or ';' before ':' token {int nrcuv=0: ^ textcuv.cpp:38:20: warning: statement has no effect [-Wunused-value] for(i=0;i<n;i++) ^ textcuv.cpp:38:26: error: expected ';' before ')' token for(i=0;i<n;i++) ^ textcuv.cpp:41:15: error: 'fout' was not declared in this scope fout<<nrcuv<<'\n'; ^ textcuv.cpp:47:22: error: found ':' in nested-name-specifier, expected '::' for(i=0;i<n:i++) ^ textcuv.cpp:47:21: error: 'n' is not a class, namespace, or enumeration for(i=0;i<n:i++) ^ textcuv.cpp:47:26: error: expected ';' before ')' token for(i=0;i<n:i++) ^ textcuv.cpp:48:32: error: lvalue required as left operand of assignment {for(j=strlen(cuv[i])=1;j>=0;j--) ^ textcuv.cpp:49:15: error: 'fout' was not declared in this scope fout<<cuv[i][j]; ^ textcuv.cpp:50:12: error: 'fout' was not declared in this scope fout<<'\n'; ^ textcuv.cpp:59:20: error: expected ')' before ';' token nra++; ^ textcuv.cpp:61:15: error: 'fout' was not declared in this scope fout<<nra<<'\n'; ^ textcuv.cpp:69:34: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] {if(strlen(cuv[i]<lmin) ^ textcuv.cpp:69:38: error: cannot convert 'bool' to 'const char*' for argument '1' to 'size_t strlen(const char*)' {if(strlen(cuv[i]<lmin) ^ textcuv.cpp:70:20: error: expected ')' before 'lmin' lmin=strlen(cuv[i]); ^ textcuv.cpp:71:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if(strlen(cuv[i])>lmax ^ textcuv.cpp:72:23: error: expected ')' before 'lmax' lmax=strlen(cuv[i]); ^ textcuv.cpp:74:23: error: 'fout' was not declared in this scope fout<<lmin<<' '<<lmax<<;'\n'; ^ textcuv.cpp:74:46: error: expected primary-expression before ';' token fout<<lmin<<' '<<lmax<<;'\n'; ^ textcuv.cpp:74:51: warning: statement has no effect [-Wunused-value] fout<<lmin<<' '<<lmax<<;'\n'; ^ textcuv.cpp:77:23: error: 'fout' was not declared in this scope fout.close(); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema textcuv 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ă.