#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 | #53555493 | Utilizator | |
Fișier | sablon.cpp | Dimensiune | 460 B |
Data încărcării | 05 Noiembrie 2024, 08:50 | Scor / rezultat | Eroare de compilare |
sablon.cpp:11:19: warning: character constant too long for its type [enabled by default] if(strchr('aeiou', a[i]) && strchr('aeiou', b[i])) ^ sablon.cpp:11:44: warning: character constant too long for its type [enabled by default] if(strchr('aeiou', a[i]) && strchr('aeiou', b[i])) ^ sablon.cpp:13:25: warning: character constant too long for its type [enabled by default] else if(!strchr('aeiou', a[i]) && !strchr('aeiou', b[i])) ^ sablon.cpp:13:51: warning: character constant too long for its type [enabled by default] else if(!strchr('aeiou', a[i]) && !strchr('aeiou', b[i])) ^ sablon.cpp: In function 'int main()': sablon.cpp:9:5: error: 'k' was not declared in this scope k = 0; ^ sablon.cpp:10:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (i = 0; i < strlen(a); i++) ^ sablon.cpp:11:32: error: call of overloaded 'strchr(int, char&)' is ambiguous if(strchr('aeiou', a[i]) && strchr('aeiou', b[i])) ^ sablon.cpp:11:32: note: candidates are: In file included from /usr/include/c++/4.8/cstring:42:0, from sablon.cpp:2: /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 1 from 'int' to 'char*' /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 1 from 'int' to 'const char*' sablon.cpp:11:57: error: call of overloaded 'strchr(int, char&)' is ambiguous if(strchr('aeiou', a[i]) && strchr('aeiou', b[i])) ^ sablon.cpp:11:57: note: candidates are: In file included from /usr/include/c++/4.8/cstring:42:0, from sablon.cpp:2: /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 1 from 'int' to 'char*' /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 1 from 'int' to 'const char*' sablon.cpp:13:38: error: call of overloaded 'strchr(int, char&)' is ambiguous else if(!strchr('aeiou', a[i]) && !strchr('aeiou', b[i])) ^ sablon.cpp:13:38: note: candidates are: In file included from /usr/include/c++/4.8/cstring:42:0, from sablon.cpp:2: /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 1 from 'int' to 'char*' /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 1 from 'int' to 'const char*' sablon.cpp:13:64: error: call of overloaded 'strchr(int, char&)' is ambiguous else if(!strchr('aeiou', a[i]) && !strchr('aeiou', b[i])) ^ sablon.cpp:13:64: note: candidates are: In file included from /usr/include/c++/4.8/cstring:42:0, from sablon.cpp:2: /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 1 from 'int' to 'char*' /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 1 from 'int' to 'const char*'
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ă.