#3113
Se dă un șir de caractere care conține litere mici și mari ale alfabetului englez, spații și semne de punctuație. Să se afișeze fiecare cuvânt și frecvența de apariție a lui în șirul de caractere pe câte o linie fiecare pereche cuvânt-frecvență ordonate lexicografic.
Problema | CountWords | Operații I/O |
![]() |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 64 MB
|
Id soluție | #29142981 | Utilizator | |
Fișier | countwords.cpp | Dimensiune | 772 B |
Data încărcării | 02 Aprilie 2021, 12:23 | Scor / rezultat | Eroare de compilare |
countwords.cpp: In function 'int main()': countwords.cpp:15:17: error: 'sep' was not declared in this scope p=strtok(s, sep); ^ countwords.cpp:20:26: warning: array subscript has type 'char' [-Wchar-subscripts] if(strcmp(v[i].sir, p)==0) ^ countwords.cpp:21:20: warning: array subscript has type 'char' [-Wchar-subscripts] v[i].k++, ok=1; ^ countwords.cpp:23:29: warning: array subscript has type 'char' [-Wchar-subscripts] n++, strcpy(v[n].sir, p), v[n].k=1; ^ countwords.cpp:23:43: warning: array subscript has type 'char' [-Wchar-subscripts] n++, strcpy(v[n].sir, p), v[n].k=1; ^ countwords.cpp:28:26: warning: array subscript has type 'char' [-Wchar-subscripts] if(strcmp(v[i].sir, v[j].sir)>0) ^ countwords.cpp:28:36: warning: array subscript has type 'char' [-Wchar-subscripts] if(strcmp(v[i].sir, v[j].sir)>0) ^ countwords.cpp:30:24: warning: array subscript has type 'char' [-Wchar-subscripts] aux=v[i]; ^ countwords.cpp:31:20: warning: array subscript has type 'char' [-Wchar-subscripts] v[i]=v[j]; ^ countwords.cpp:31:25: warning: array subscript has type 'char' [-Wchar-subscripts] v[i]=v[j]; ^ countwords.cpp:32:20: warning: array subscript has type 'char' [-Wchar-subscripts] v[j]=aux; ^ countwords.cpp:35:18: warning: array subscript has type 'char' [-Wchar-subscripts] cout<<v[i].sir<<' '<<v[i].k<<'\n'; ^ countwords.cpp:35:33: warning: array subscript has type 'char' [-Wchar-subscripts] cout<<v[i].sir<<' '<<v[i].k<<'\n'; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema CountWords 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ă.