#135
Sablon
Să se scrie un program care determină cel mai bun șablon comun a două șiruri de caractere.
Variante Bacalaureat 2009
Problema | Sablon | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #16709889 | Utilizator | |
Fișier | sablon.cpp | Dimensiune | 366 B |
Data încărcării | 17 Septembrie 2019, 13:57 | Scor / rezultat | Eroare de compilare |
sablon.cpp: In function 'int main()': sablon.cpp:10:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i=0;i<strlen(s);i++){ ^ sablon.cpp:11:32: error: call of overloaded 'strchr(char&, const char [11])' is ambiguous if(strchr(s[i],"aeiouAEIOU")==0&&strchr(t[i],"aeiouAEIOU")==0)k[i]='*'; ^ sablon.cpp:11:32: note: candidates are: In file included from sablon.cpp:2:0: /usr/include/string.h:223:1: note: char* strchr(char*, int) <near match> strchr (char *__s, int __c) __THROW ^ /usr/include/string.h:223:1: note: no known conversion for argument 2 from 'const char [11]' to 'int' /usr/include/string.h:229:1: note: const char* strchr(const char*, int) <near match> strchr (const char *__s, int __c) __THROW ^ /usr/include/string.h:229:1: note: no known conversion for argument 2 from 'const char [11]' to 'int' sablon.cpp:11:62: error: call of overloaded 'strchr(char&, const char [11])' is ambiguous if(strchr(s[i],"aeiouAEIOU")==0&&strchr(t[i],"aeiouAEIOU")==0)k[i]='*'; ^ sablon.cpp:11:62: note: candidates are: In file included from sablon.cpp:2:0: /usr/include/string.h:223:1: note: char* strchr(char*, int) <near match> strchr (char *__s, int __c) __THROW ^ /usr/include/string.h:223:1: note: no known conversion for argument 2 from 'const char [11]' to 'int' /usr/include/string.h:229:1: note: const char* strchr(const char*, int) <near match> strchr (const char *__s, int __c) __THROW ^ /usr/include/string.h:229:1: note: no known conversion for argument 2 from 'const char [11]' to 'int' sablon.cpp:12:18: warning: left operand of comma operator has no effect [-Wunused-value] if(strchr[s[i],"aeiouAEIOU")==1&&strchr[t[i],"aeiouAEIOU")==1)k[i]='#'; ^ sablon.cpp:12:32: error: expected ']' before ')' token if(strchr[s[i],"aeiouAEIOU")==1&&strchr[t[i],"aeiouAEIOU")==1)k[i]='#'; ^ sablon.cpp:12:32: error: invalid types '<unresolved overloaded function type>[const char [11]]' for array subscript sablon.cpp:12:33: error: expected primary-expression before '==' token if(strchr[s[i],"aeiouAEIOU")==1&&strchr[t[i],"aeiouAEIOU")==1)k[i]='#'; ^ sablon.cpp:12:48: warning: left operand of comma operator has no effect [-Wunused-value] if(strchr[s[i],"aeiouAEIOU")==1&&strchr[t[i],"aeiouAEIOU")==1)k[i]='#'; ^ sablon.cpp:12:62: error: expected ']' before ')' token if(strchr[s[i],"aeiouAEIOU")==1&&strchr[t[i],"aeiouAEIOU")==1)k[i]='#'; ^ sablon.cpp:12:62: error: invalid types '<unresolved overloaded function type>[const char [11]]' for array subscript sablon.cpp:12:62: error: expected ';' before ')' token
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Sablon 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ă.