#2953
inserarechar
C++
Scrieți un program care citește un cuvânt cu cel mult 15
litere mici ale alfabetului englez și apoi un text cu cel mult 255
de caractere (cuvinte formate din litere mici ale alfabetului englez separate prin unul sau mai multe spații) și care afișează șirul obținut prin inserarea în text a caracterului ?
după fiecare apariție a cuvântului citit. Dacă în text nu apare cuvântul citit, se va afișa mesajul NU APARE
.
Bacalaureat 2009
Problema | inserarechar | Operații I/O |
inserarechar.in /inserarechar.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #34386312 | Utilizator | |
Fișier | inserarechar.cpp | Dimensiune | 1.01 KB |
Data încărcării | 31 Ianuarie 2022, 18:06 | Scor / rezultat | Eroare de compilare |
inserarechar.cpp: In function 'int main()': inserarechar.cpp:11:11: error: cannot bind 'std::basic_istream<char>' lvalue to 'std::basic_istream<char>&&' fin>> cuv; ^ In file included from /usr/include/c++/4.8/iostream:40:0, from inserarechar.cpp:1: /usr/include/c++/4.8/istream:872:5: error: initializing argument 1 of 'std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&&, _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Tp = int [16]]' operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x) ^ inserarechar.cpp:13:19: error: no matching function for call to 'std::basic_ifstream<char>::get(int [501], int)' fin.get(s, 501); ^ inserarechar.cpp:13:19: note: candidates are: In file included from /usr/include/c++/4.8/iostream:40:0, from inserarechar.cpp:1: /usr/include/c++/4.8/istream:302:7: note: std::basic_istream<_CharT, _Traits>::int_type std::basic_istream<_CharT, _Traits>::get() [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::int_type = int] get(); ^ /usr/include/c++/4.8/istream:302:7: note: candidate expects 0 arguments, 2 provided /usr/include/c++/4.8/istream:316:7: note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::get(std::basic_istream<_CharT, _Traits>::char_type&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::char_type = char] get(char_type& __c); ^ /usr/include/c++/4.8/istream:316:7: note: candidate expects 1 argument, 2 provided /usr/include/c++/4.8/istream:343:7: note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::get(std::basic_istream<_CharT, _Traits>::char_type*, std::streamsize, std::basic_istream<_CharT, _Traits>::char_type) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::char_type = char; std::streamsize = int] get(char_type* __s, streamsize __n, char_type __delim); ^ /usr/include/c++/4.8/istream:343:7: note: candidate expects 3 arguments, 2 provided /usr/include/c++/4.8/istream:354:7: note: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::get(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] get(char_type* __s, streamsize __n) ^ /usr/include/c++/4.8/istream:354:7: note: no known conversion for argument 1 from 'int [501]' to 'std::basic_istream<char>::char_type* {aka char*}' /usr/include/c++/4.8/istream:377:7: note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::get(std::basic_istream<_CharT, _Traits>::__streambuf_type&, std::basic_istream<_CharT, _Traits>::char_type) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__streambuf_type = std::basic_streambuf<char>; std::basic_istream<_CharT, _Traits>::char_type = char] get(__streambuf_type& __sb, char_type __delim); ^ /usr/include/c++/4.8/istream:377:7: note: no known conversion for argument 1 from 'int [501]' to 'std::basic_istream<char>::__streambuf_type& {aka std::basic_streambuf<char>&}' /usr/include/c++/4.8/istream:387:7: note: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::get(std::basic_istream<_CharT, _Traits>::__streambuf_type&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>; std::basic_istream<_CharT, _Traits>::__streambuf_type = std::basic_streambuf<char>] get(__streambuf_type& __sb) ^ /usr/include/c++/4.8/istream:387:7: note: candidate expects 1 argument, 2 provided inserarechar.cpp:14:24: error: cannot convert 'int*' to 'const char*' for argument '1' to 'size_t strlen(const char*)' for(i=0; i<strlen(s); i++) ^ inserarechar.cpp:19:34: error: cannot convert 'int*' to 'const char*' for argument '1' to 'size_t strlen(const char*)' for(j=0; j<strlen(cuv); j++) ^ inserarechar.cpp:28:37: error: cannot convert 'int*' to 'const char*' for argument '1' to 'size_t strlen(const char*)' if(ok==1 && (i==strlen(s) || (i<strlen(s) && s[i]== ' '))) ^ inserarechar.cpp:28:53: error: cannot convert 'int*' to 'const char*' for argument '1' to 'size_t strlen(const char*)' if(ok==1 && (i==strlen(s) || (i<strlen(s) && s[i]== ' '))) ^ inserarechar.cpp:30:31: error: cannot convert 'int*' to 'const char*' for argument '1' to 'size_t strlen(const char*)' for(k=strlen(s); k>=i; i--) ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema inserarechar 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ă.