#2346
ParitateSiruri
Se dau mai multe șiruri de caractere. Pentru fiecare șir, afișați șirul format doar din caracterele aflate pe poziții impare și șirul format din caracterele aflate pe poziții pare. Cele două șiruri vor fi separate printr-un singur spațiu, pe câte o linie.
Problema | ParitateSiruri | Operații I/O |
paritatesiruri.in /paritatesiruri.out
|
---|---|---|---|
Limita timp | 1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #53526885 | Utilizator | |
Fișier | paritatesiruri.cpp | Dimensiune | 590 B |
Data încărcării | 04 Noiembrie 2024, 11:58 | Scor / rezultat | Eroare de compilare |
paritatesiruri.cpp: In function 'int main()': paritatesiruri.cpp:9:13: error: expected identifier before numeric constant char s=[10001]; ^ paritatesiruri.cpp: In lambda function: paritatesiruri.cpp:9:19: error: expected '{' before ';' token char s=[10001]; ^ paritatesiruri.cpp: In function 'int main()': paritatesiruri.cpp:9:19: error: invalid user-defined conversion from 'main()::__lambda0' to 'char' [-fpermissive] paritatesiruri.cpp:9:18: note: candidate is: main()::__lambda0::operator void (*)()() const <near match> char s=[10001]; ^ paritatesiruri.cpp:9:18: note: no known conversion for implicit 'this' parameter from 'void (*)()' to 'char' paritatesiruri.cpp:10:13: error: expected identifier before numeric constant char a=[5001],b=[5001] ^ paritatesiruri.cpp: In lambda function: paritatesiruri.cpp:10:18: error: expected '{' before ',' token char a=[5001],b=[5001] ^ paritatesiruri.cpp: In function 'int main()': paritatesiruri.cpp:10:18: error: invalid user-defined conversion from 'main()::__lambda1' to 'char' [-fpermissive] paritatesiruri.cpp:10:17: note: candidate is: main()::__lambda1::operator void (*)()() const <near match> char a=[5001],b=[5001] ^ paritatesiruri.cpp:10:17: note: no known conversion for implicit 'this' parameter from 'void (*)()' to 'char' paritatesiruri.cpp:10:22: error: expected identifier before numeric constant char a=[5001],b=[5001] ^ paritatesiruri.cpp: In lambda function: paritatesiruri.cpp:11:5: error: expected '{' before 'cin' cin>>n; ^ paritatesiruri.cpp: In function 'int main()': paritatesiruri.cpp:11:5: error: invalid user-defined conversion from 'main()::__lambda2' to 'char' [-fpermissive] paritatesiruri.cpp:10:26: note: candidate is: main()::__lambda2::operator void (*)()() const <near match> char a=[5001],b=[5001] ^ paritatesiruri.cpp:10:26: note: no known conversion for implicit 'this' parameter from 'void (*)()' to 'char' paritatesiruri.cpp:11:5: error: expected ',' or ';' before 'cin' cin>>n; ^ paritatesiruri.cpp:17:28: error: invalid conversion from 'char' to 'std::basic_istream<char>::char_type* {aka char*}' [-fpermissive] cin.getline(s,10001); ^ In file included from /usr/include/c++/4.8/fstream:38:0, from paritatesiruri.cpp:1: /usr/include/c++/4.8/istream:427:7: error: initializing argument 1 of 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::getline(std::basic_istream<_CharT, _Traits>::char_type*, std::streamsize) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>; std::basic_istream<_CharT, _Traits>::char_type = char; std::streamsize = int]' [-fpermissive] getline(char_type* __s, streamsize __n) ^ paritatesiruri.cpp:18:27: error: invalid conversion from 'char' to 'const char*' [-fpermissive] for(j=0;j<strlen(s);j+=2) ^ In file included from /usr/include/c++/4.8/cstring:42:0, from paritatesiruri.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) ^ paritatesiruri.cpp:18:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(j=0;j<strlen(s);j+=2) ^ paritatesiruri.cpp:19:18: error: invalid types 'char[int]' for array subscript a[k++]=s[j]; ^ paritatesiruri.cpp:19:23: error: invalid types 'char[int]' for array subscript a[k++]=s[j]; ^ paritatesiruri.cpp:20:12: error: invalid types 'char[int]' for array subscript a[k]='\0'; ^ paritatesiruri.cpp:22:27: error: invalid conversion from 'char' to 'const char*' [-fpermissive] for(j=1;j<strlen(s);j+=2) ^ In file included from /usr/include/c++/4.8/cstring:42:0, from paritatesiruri.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) ^ paritatesiruri.cpp:22:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(j=1;j<strlen(s);j+=2) ^ paritatesiruri.cpp:23:18: error: invalid types 'char[int]' for array subscript b[k++]=s[j]; ^ paritatesiruri.cpp:23:23: error: invalid types 'char[int]' for array subscript b[k++]=s[j]; ^ paritatesiruri.cpp:24:12: error: invalid types 'char[int]' for array subscript b[k]='\0'; ^ paritatesiruri.cpp:25:17: error: invalid types 'char[int]' for array subscript cin>>s[j] ^ paritatesiruri.cpp:26:9: error: expected ';' before 'cout' cout<<a<<" "<<b<<endl; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema ParitateSiruri 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ă.