#1456
Cuvant
Se consideră un cuvânt format din cel puțin două și cel mult 100
de caractere, numai litere mici ale alfabetului englez.
Scrieţi un program care citeşte de la tastatură un cuvânt de tipul precizat și afișează pe ecran mesajul DA
în cazul în care cuvântul conține doar consoane şi, eventual, vocala i
, sau mesajul NU
în caz contrar.
Subiect Bacalaureat 2015, sesiunea august-septembrie
Problema | Cuvant | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #52430509 | Utilizator | |
Fișier | cuvant.cpp | Dimensiune | 409 B |
Data încărcării | 30 Septembrie 2024, 09:41 | Scor / rezultat | Eroare de compilare |
cuvant.cpp: In function 'int main()': cuvant.cpp:10:23: error: no matching function for call to 'begin(int&)' for (char litera : cuv) ^ cuvant.cpp:10:23: note: candidates are: In file included from /usr/include/c++/4.8/bits/basic_string.h:42:0, from /usr/include/c++/4.8/string:52, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from cuvant.cpp:1: /usr/include/c++/4.8/initializer_list:89:5: note: template<class _Tp> constexpr const _Tp* std::begin(std::initializer_list<_Tp>) begin(initializer_list<_Tp> __ils) noexcept ^ /usr/include/c++/4.8/initializer_list:89:5: note: template argument deduction/substitution failed: cuvant.cpp:10:23: note: mismatched types 'std::initializer_list<_Tp>' and 'int' for (char litera : cuv) ^ In file included from /usr/include/c++/4.8/string:51:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from cuvant.cpp:1: /usr/include/c++/4.8/bits/range_access.h:87:5: note: template<class _Tp, unsigned int _Nm> _Tp* std::begin(_Tp (&)[_Nm]) begin(_Tp (&__arr)[_Nm]) ^ /usr/include/c++/4.8/bits/range_access.h:87:5: note: template argument deduction/substitution failed: cuvant.cpp:10:23: note: mismatched types '_Tp [_Nm]' and 'int' for (char litera : cuv) ^ In file included from /usr/include/c++/4.8/string:51:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from cuvant.cpp:1: /usr/include/c++/4.8/bits/range_access.h:58:5: note: template<class _Container> decltype (__cont.begin()) std::begin(const _Container&) begin(const _Container& __cont) -> decltype(__cont.begin()) ^ /usr/include/c++/4.8/bits/range_access.h:58:5: note: template argument deduction/substitution failed: /usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.begin()) std::begin(const _Container&) [with _Container = int]': cuvant.cpp:10:23: required from here /usr/include/c++/4.8/bits/range_access.h:58:5: error: request for member 'begin' in '__cont', which is of non-class type 'const int' /usr/include/c++/4.8/bits/range_access.h:48:5: note: template<class _Container> decltype (__cont.begin()) std::begin(_Container&) begin(_Container& __cont) -> decltype(__cont.begin()) ^ /usr/include/c++/4.8/bits/range_access.h:48:5: note: template argument deduction/substitution failed: /usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.begin()) std::begin(_Container&) [with _Container = int]': cuvant.cpp:10:23: required from here /usr/include/c++/4.8/bits/range_access.h:48:5: error: request for member 'begin' in '__cont', which is of non-class type 'int' cuvant.cpp:10:23: error: no matching function for call to 'end(int&)' for (char litera : cuv) ^ cuvant.cpp:10:23: note: candidates are: In file included from /usr/include/c++/4.8/bits/basic_string.h:42:0, from /usr/include/c++/4.8/string:52, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from cuvant.cpp:1: /usr/include/c++/4.8/initializer_list:99:5: note: template<class _Tp> constexpr const _Tp* std::end(std::initializer_list<_Tp>) end(initializer_list<_Tp> __ils) noexcept ^ /usr/include/c++/4.8/initializer_list:99:5: note: template argument deduction/substitution failed: cuvant.cpp:10:23: note: mismatched types 'std::initializer_list<_Tp>' and 'int' for (char litera : cuv) ^ In file included from /usr/include/c++/4.8/string:51:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from cuvant.cpp:1: /usr/include/c++/4.8/bits/range_access.h:97:5: note: template<class _Tp, unsigned int _Nm> _Tp* std::end(_Tp (&)[_Nm]) end(_Tp (&__arr)[_Nm]) ^ /usr/include/c++/4.8/bits/range_access.h:97:5: note: template argument deduction/substitution failed: cuvant.cpp:10:23: note: mismatched types '_Tp [_Nm]' and 'int' for (char litera : cuv) ^ In file included from /usr/include/c++/4.8/string:51:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from cuvant.cpp:1: /usr/include/c++/4.8/bits/range_access.h:78:5: note: template<class _Container> decltype (__cont.end()) std::end(const _Container&) end(const _Container& __cont) -> decltype(__cont.end()) ^ /usr/include/c++/4.8/bits/range_access.h:78:5: note: template argument deduction/substitution failed: /usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.end()) std::end(const _Container&) [with _Container = int]': cuvant.cpp:10:23: required from here /usr/include/c++/4.8/bits/range_access.h:78:5: error: request for member 'end' in '__cont', which is of non-class type 'const int' /usr/include/c++/4.8/bits/range_access.h:68:5: note: template<class _Container> decltype (__cont.end()) std::end(_Container&) end(_Container& __cont) -> decltype(__cont.end()) ^ /usr/include/c++/4.8/bits/range_access.h:68:5: note: template argument deduction/substitution failed: /usr/include/c++/4.8/bits/range_access.h: In substitution of 'template<class _Container> decltype (__cont.end()) std::end(_Container&) [with _Container = int]': cuvant.cpp:10:23: required from here /usr/include/c++/4.8/bits/range_access.h:68:5: error: request for member 'end' in '__cont', which is of non-class type 'int' cuvant.cpp:16:24: error: request for member 'size' in 'cuv', which is of non-class type 'int' for (i = 1; i < cuv.size(); ++i) ^ cuvant.cpp:17:20: error: invalid types 'int[int]' for array subscript if (cuv[i - 1] == 'i' && cuv[i] == 'i') ^ cuvant.cpp:17:37: error: invalid types 'int[int]' for array subscript if (cuv[i - 1] == 'i' && cuv[i] == 'i') ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Cuvant 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ă.