#2693
VocSortDesc
Se dă un șir de caractere în care cuvintele sunt formate din litere mici și mari ale alfabetului englez și sunt separate prin spații. Să se afișeze cuvintele în ordine descrescătoare după numărul de vocale și să se afișeze fiecare cuvânt pe câte o linie. Dacă două cuvinte au același număr de vocale atunci ele se vor ordona descrescător după lungime, iar dacă au aceeași lungime atunci se vor ordona lexicografic.
Problema | VocSortDesc | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #54934188 | Utilizator | |
Fișier | vocsortdesc.cpp | Dimensiune | 898 B |
Data încărcării | 12 Decembrie 2024, 17:39 | Scor / rezultat | Eroare de compilare |
vocsortdesc.cpp: In function 'int main()': vocsortdesc.cpp:20:21: error: invalid conversion from 'char' to 'char*' [-fpermissive] strcpy(a[++k],p); ^ In file included from /usr/include/features.h:374:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/os_defines.h:39, from /usr/include/i386-linux-gnu/c++/4.8/bits/c++config.h:426, from /usr/include/c++/4.8/iostream:38, from vocsortdesc.cpp:1: /usr/include/i386-linux-gnu/bits/string3.h:102:1: error: initializing argument 1 of 'char* strcpy(char*, const char*)' [-fpermissive] __NTH (strcpy (char *__restrict __dest, const char *__restrict __src)) ^ vocsortdesc.cpp:24:19: error: invalid conversion from 'char' to 'char*' [-fpermissive] if(cnt(a[i])<cnt(a[i+1])) ^ vocsortdesc.cpp:9:5: error: initializing argument 1 of 'int cnt(char*)' [-fpermissive] int cnt(char s[]){ ^ vocsortdesc.cpp:24:31: error: invalid conversion from 'char' to 'char*' [-fpermissive] if(cnt(a[i])<cnt(a[i+1])) ^ vocsortdesc.cpp:9:5: error: initializing argument 1 of 'int cnt(char*)' [-fpermissive] int cnt(char s[]){ ^ vocsortdesc.cpp:25:40: error: invalid conversion from 'char' to 'char*' [-fpermissive] swap(a[i],a[i+1]), swap(cnt(a[i]),cnt(a[i+1])); ^ vocsortdesc.cpp:9:5: error: initializing argument 1 of 'int cnt(char*)' [-fpermissive] int cnt(char s[]){ ^ vocsortdesc.cpp:25:52: error: invalid conversion from 'char' to 'char*' [-fpermissive] swap(a[i],a[i+1]), swap(cnt(a[i]),cnt(a[i+1])); ^ vocsortdesc.cpp:9:5: error: initializing argument 1 of 'int cnt(char*)' [-fpermissive] int cnt(char s[]){ ^ vocsortdesc.cpp:25:54: error: no matching function for call to 'swap(int, int)' swap(a[i],a[i+1]), swap(cnt(a[i]),cnt(a[i+1])); ^ vocsortdesc.cpp:25:54: note: candidates are: In file included from /usr/include/c++/4.8/bits/stl_pair.h:59:0, from /usr/include/c++/4.8/bits/stl_algobase.h:64, from /usr/include/c++/4.8/bits/char_traits.h:39, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from vocsortdesc.cpp:1: /usr/include/c++/4.8/bits/move.h:166:5: note: void std::swap(_Tp&, _Tp&) [with _Tp = int] swap(_Tp& __a, _Tp& __b) ^ /usr/include/c++/4.8/bits/move.h:166:5: note: no known conversion for argument 1 from 'int' to 'int&' /usr/include/c++/4.8/bits/move.h:185:5: note: template<class _Tp, unsigned int _Nm> void std::swap(_Tp (&)[_Nm], _Tp (&)[_Nm]) swap(_Tp (&__a)[_Nm], _Tp (&__b)[_Nm]) ^ /usr/include/c++/4.8/bits/move.h:185:5: note: template argument deduction/substitution failed: vocsortdesc.cpp:25:54: note: mismatched types '_Tp [_Nm]' and 'int' swap(a[i],a[i+1]), swap(cnt(a[i]),cnt(a[i+1])); ^ In file included from /usr/include/c++/4.8/bits/stl_algobase.h:64:0, from /usr/include/c++/4.8/bits/char_traits.h:39, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from vocsortdesc.cpp:1: /usr/include/c++/4.8/bits/stl_pair.h:254:5: note: template<class _T1, class _T2> void std::swap(std::pair<_T1, _T2>&, std::pair<_T1, _T2>&) swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y) ^ /usr/include/c++/4.8/bits/stl_pair.h:254:5: note: template argument deduction/substitution failed: vocsortdesc.cpp:25:54: note: mismatched types 'std::pair<_T1, _T2>' and 'int' swap(a[i],a[i+1]), swap(cnt(a[i]),cnt(a[i+1])); ^ In file included from /usr/include/c++/4.8/string:52:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from vocsortdesc.cpp:1: /usr/include/c++/4.8/bits/basic_string.h:2717:5: note: template<class _CharT, class _Traits, class _Alloc> void std::swap(std::basic_string<_CharT, _Traits, _Alloc>&, std::basic_string<_CharT, _Traits, _Alloc>&) swap(basic_string<_CharT, _Traits, _Alloc>& __lhs, ^ /usr/include/c++/4.8/bits/basic_string.h:2717:5: note: template argument deduction/substitution failed: vocsortdesc.cpp:25:54: note: mismatched types 'std::basic_string<_CharT, _Traits, _Alloc>' and 'int' swap(a[i],a[i+1]), swap(cnt(a[i]),cnt(a[i+1])); ^ vocsortdesc.cpp:28:16: error: invalid conversion from 'char' to 'char*' [-fpermissive] if((cnt(a[i])==cnt(a[i+1]))&& (strlen(a[i])<strlen(a[i+1]))) ^ vocsortdesc.cpp:9:5: error: initializing argument 1 of 'int cnt(char*)' [-fpermissive] int cnt(char s[]){ ^ vocsortdesc.cpp:28:29: error: invalid conversion from 'char' to 'char*' [-fpermissive] if((cnt(a[i])==cnt(a[i+1]))&& (strlen(a[i])<strlen(a[i+1]))) ^ vocsortdesc.cpp:9:5: error: initializing argument 1 of 'int cnt(char*)' [-fpermissive] int cnt(char s[]){ ^ vocsortdesc.cpp:28:46: error: invalid conversion from 'char' to 'const char*' [-fpermissive] if((cnt(a[i])==cnt(a[i+1]))&& (strlen(a[i])<strlen(a[i+1]))) ^ In file included from /usr/include/c++/4.8/cstring:42:0, from vocsortdesc.cpp:2: /usr/include/string.h:399:15: error: initializing argument 1 of 'size_t strlen(const char*)' [-fpermissive] extern size_t strlen (const char *__s) ^ vocsortdesc.cpp:28:61: error: invalid conversion from 'char' to 'const char*' [-fpermissive] if((cnt(a[i])==cnt(a[i+1]))&& (strlen(a[i])<strlen(a[i+1]))) ^ In file included from /usr/include/c++/4.8/cstring:42:0, from vocsortdesc.cpp:2: /usr/include/string.h:399:15: error: initializing argument 1 of 'size_t strlen(const char*)' [-fpermissive] extern size_t strlen (const char *__s) ^ vocsortdesc.cpp:31:16: error: invalid conversion from 'char' to 'char*' [-fpermissive] if((cnt(a[i])==cnt(a[i+1])) && strlen((a[i])==strlen(a[i+1])) && (strcmp(a[i],a[i+1])==1)) ^ vocsortdesc.cpp:9:5: error: initializing argument 1 of 'int cnt(char*)' [-fpermissive] int cnt(char s[]){ ^ vocsortdesc.cpp:31:29: error: invalid conversion from 'char' to 'char*' [-fpermissive] if((cnt(a[i])==cnt(a[i+1])) && strlen((a[i])==strlen(a[i+1])) && (strcmp(a[i],a[i+1])==1)) ^ vocsortdesc.cpp:9:5: error: initializing argument 1 of 'int cnt(char*)' [-fpermissive] int cnt(char s[]){ ^ vocsortdesc.cpp:31:63: error: invalid conversion from 'char' to 'const char*' [-fpermissive] if((cnt(a[i])==cnt(a[i+1])) && strlen((a[i])==strlen(a[i+1])) && (strcmp(a[i],a[i+1])==1)) ^ In file included from /usr/include/c++/4.8/cstring:42:0, from vocsortdesc.cpp:2: /usr/include/string.h:399:15: error: initializing argument 1 of 'size_t strlen(const char*)' [-fpermissive] extern size_t strlen (const char *__s) ^ vocsortdesc.cpp:31:64: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if((cnt(a[i])==cnt(a[i+1])) && strlen((a[i])==strlen(a[i+1])) && (strcmp(a[i],a[i+1])==1)) ^ vocsortdesc.cpp:31:65: error: cannot convert 'bool' to 'const char*' for argument '1' to 'size_t strlen(const char*)' if((cnt(a[i])==cnt(a[i+1])) && strlen((a[i])==strlen(a[i+1])) && (strcmp(a[i],a[i+1])==1)) ^ vocsortdesc.cpp:31:81: error: invalid conversion from 'char' to 'const char*' [-fpermissive] if((cnt(a[i])==cnt(a[i+1])) && strlen((a[i])==strlen(a[i+1])) && (strcmp(a[i],a[i+1])==1)) ^ In file included from /usr/include/c++/4.8/cstring:42:0, from vocsortdesc.cpp:2: /usr/include/string.h:144:12: error: initializing argument 1 of 'int strcmp(const char*, const char*)' [-fpermissive] extern int strcmp (const char *__s1, const char *__s2) ^ vocsortdesc.cpp:31:88: error: invalid conversion from 'char' to 'const char*' [-fpermissive] if((cnt(a[i])==cnt(a[i+1])) && strlen((a[i])==strlen(a[i+1])) && (strcmp(a[i],a[i+1])==1)) ^ In file included from /usr/include/c++/4.8/cstring:42:0, from vocsortdesc.cpp:2: /usr/include/string.h:144:12: error: initializing argument 2 of 'int strcmp(const char*, const char*)' [-fpermissive] extern int strcmp (const char *__s1, const char *__s2) ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema VocSortDesc 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ă.