#13
Prefixe
Să se scrie un program care să afişeze prefixele şi sufixele unui cuvânt citit.
Problema | Prefixe | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #43846940 | Utilizator | |
Fișier | prefixe.cpp | Dimensiune | 303 B |
Data încărcării | 19 Mai 2023, 18:04 | Scor / rezultat | Eroare de compilare |
prefixe.cpp: In function 'int main()': prefixe.cpp:12:12: error: invalid conversion from 'char' to 'char*' [-fpermissive] strcpy(b,a); ^ 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 prefixe.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)) ^ prefixe.cpp:15:8: warning: converting to non-pointer type 'char' from NULL [-Wconversion-null] a[i]=NULL; ^ prefixe.cpp:19:15: error: invalid conversion from 'char' to 'const char*' [-fpermissive] for(i=strlen(b)-1;i>=1;i--) ^ In file included from prefixe.cpp:2:0: /usr/include/string.h:399:15: error: initializing argument 1 of 'size_t strlen(const char*)' [-fpermissive] extern size_t strlen (const char *__s) ^ prefixe.cpp:21:14: error: invalid conversion from 'char' to 'char*' [-fpermissive] strcpy(b,b+i);} ^ 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 prefixe.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)) ^ prefixe.cpp:21:12: error: invalid conversion from 'int' to 'const char*' [-fpermissive] strcpy(b,b+i);} ^ 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 prefixe.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)) ^ prefixe.cpp:9:8: warning: unused variable 'ok' [-Wunused-variable] int i,ok=0; ^ prefixe.cpp:21:16: error: expected '}' at end of input strcpy(b,b+i);} ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Prefixe 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ă.