#188
InlocuireCuvant
Se dau două cuvinte şi o propoziţie. Să se înlocuiască în propoziţie fiecare apariţie a primului cuvânt cu al doilea.
Problema | InlocuireCuvant | Operații I/O |
inlocuirecuvant.in /inlocuirecuvant.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #37048645 | Utilizator | |
Fișier | inlocuirecuvant.cpp | Dimensiune | 600 B |
Data încărcării | 20 Iunie 2022, 17:57 | Scor / rezultat | Eroare de compilare |
inlocuirecuvant.cpp: In function 'int main()': inlocuirecuvant.cpp:16:6: error: invalid conversion from 'char*' to 'char' [-fpermissive] p=s; ^ inlocuirecuvant.cpp:17:23: error: call of overloaded 'strstr(char&, char [50])' is ambiguous while(q=strstr(p,a)) ^ inlocuirecuvant.cpp:17:23: note: candidates are: In file included from /usr/include/c++/4.8/cstring:42:0, from inlocuirecuvant.cpp:2: /usr/include/string.h:329:1: note: char* strstr(char*, const char*) <near match> strstr (char *__haystack, const char *__needle) __THROW ^ /usr/include/string.h:329:1: note: no known conversion for argument 1 from 'char' to 'char*' /usr/include/string.h:335:1: note: const char* strstr(const char*, const char*) <near match> strstr (const char *__haystack, const char *__needle) __THROW ^ /usr/include/string.h:335:1: note: no known conversion for argument 1 from 'char' to 'const char*' inlocuirecuvant.cpp:19:16: error: ISO C++ forbids comparison between pointer and integer [-fpermissive] if((q==s ||(*(q-1)==' '))&&(*(q+la)==0||(*(q+la)==' '))) ^ inlocuirecuvant.cpp:19:26: error: invalid type argument of unary '*' (have 'int') if((q==s ||(*(q-1)==' '))&&(*(q+la)==0||(*(q+la)==' '))) ^ inlocuirecuvant.cpp:19:43: error: invalid type argument of unary '*' (have 'int') if((q==s ||(*(q-1)==' '))&&(*(q+la)==0||(*(q+la)==' '))) ^ inlocuirecuvant.cpp:19:56: error: invalid type argument of unary '*' (have 'int') if((q==s ||(*(q-1)==' '))&&(*(q+la)==0||(*(q+la)==' '))) ^ inlocuirecuvant.cpp:20:20: error: invalid conversion from 'int' to 'const char*' [-fpermissive] {strcpy(t,q+la); ^ 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 inlocuirecuvant.cpp:1: /usr/include/i386-linux-gnu/bits/string3.h:102:1: error: initializing argument 2 of 'char* strcpy(char*, const char*)' [-fpermissive] __NTH (strcpy (char *__restrict __dest, const char *__restrict __src)) ^ inlocuirecuvant.cpp:21:19: error: invalid conversion from 'char' to 'char*' [-fpermissive] strcpy(q,b); ^ 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 inlocuirecuvant.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)) ^ inlocuirecuvant.cpp:22:19: error: invalid conversion from 'char' to 'char*' [-fpermissive] strcat(q,t); ^ 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 inlocuirecuvant.cpp:1: /usr/include/i386-linux-gnu/bits/string3.h:140:1: error: initializing argument 1 of 'char* strcat(char*, const char*)' [-fpermissive] __NTH (strcat (char *__restrict __dest, const char *__restrict __src)) ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema InlocuireCuvant 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ă.