#11
Să se scrie un program care citeşte un şir de caractere format din litere mici ale alfabetului englez şi înlocuieşte fiecare vocală cu litera mare corespunzătoare.
| Problema | Vocale | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64325487 | Utilizator | |
| Fișier | vocale.cpp | Dimensiune | 396 B |
| Data încărcării | 29 Aprilie 2026, 18:32 | Scor/rezultat | Eroare de compilare |
vocale.cpp: In function ‘int main()’: vocale.cpp:20:24: error: expected identifier before 'a' 20 | s[i]=s[i]-['a'-'A']; | ^~~ vocale.cpp: In lambda function: vocale.cpp:20:32: error: expected ‘{’ before ‘;’ token 20 | s[i]=s[i]-['a'-'A']; | ^ vocale.cpp: In function ‘int main()’: vocale.cpp:20:22: error: no match for ‘operator-’ (operand types are ‘char’ and ‘main()::<lambda()>’) 20 | s[i]=s[i]-['a'-'A']; | ~~~~^~~~~~~~~~ | | | | | main()::<lambda()> | char In file included from /usr/include/c++/13/string:48, from /usr/include/c++/13/bits/locale_classes.h:40, from /usr/include/c++/13/bits/ios_base.h:41, from /usr/include/c++/13/ios:44, from /usr/include/c++/13/ostream:40, from /usr/include/c++/13/iostream:41, from vocale.cpp:1: /usr/include/c++/13/bits/stl_iterator.h:625:5: note: candidate: ‘template<class _IteratorL, class _IteratorR> decltype ((__y.base() - __x.base())) std::operator-(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)’ 625 | operator-(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/13/bits/stl_iterator.h:625:5: note: template argument deduction/substitution failed: vocale.cpp:20:32: note: mismatched types ‘const std::reverse_iterator<_Iterator>’ and ‘char’ 20 | s[i]=s[i]-['a'-'A']; | ^ /usr/include/c++/13/bits/stl_iterator.h:1800:5: note: candidate: ‘template<class _IteratorL, class _IteratorR> decltype ((__x.base() - __y.base())) std::operator-(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)’ 1800 | operator-(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/13/bits/stl_iterator.h:1800:5: note: template argument deduction/substitution failed: vocale.cpp:20:32: note: mismatched types ‘const std::move_iterator<_IteratorL>’ and ‘char’ 20 | s[i]=s[i]-['a'-'A']; | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Vocale 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ă.