#1013
Se dau datele de naștere a n persoane, numerotate de la 1 la n, în forma an luna zi. Să se determine numărul de ordine al celei mai tinere și al celei mai în vârstă persoană dintre cele date.
| Problema | Aniversari | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #62359647 | Utilizator | |
| Fișier | aniversari.cpp | Dimensiune | 655 B |
| Data încărcării | 19 Ianuarie 2026, 11:50 | Scor/rezultat | Eroare de compilare |
aniversari.cpp: In function 'int main()': aniversari.cpp:12:13: error: no match for 'operator=' (operand types are 'varsta' and 'int') ma=a[0];ima=0; ^ aniversari.cpp:12:13: note: candidates are: aniversari.cpp:3:8: note: varsta& varsta::operator=(const varsta&) struct varsta { ^ aniversari.cpp:3:8: note: no known conversion for argument 1 from 'int' to 'const varsta&' aniversari.cpp:3:8: note: varsta& varsta::operator=(varsta&&) aniversari.cpp:3:8: note: no known conversion for argument 1 from 'int' to 'varsta&&' aniversari.cpp:13:13: error: no match for 'operator=' (operand types are 'varsta' and 'int') mi=a[0];imi=0; ^ aniversari.cpp:13:13: note: candidates are: aniversari.cpp:3:8: note: varsta& varsta::operator=(const varsta&) struct varsta { ^ aniversari.cpp:3:8: note: no known conversion for argument 1 from 'int' to 'const varsta&' aniversari.cpp:3:8: note: varsta& varsta::operator=(varsta&&) aniversari.cpp:3:8: note: no known conversion for argument 1 from 'int' to 'varsta&&' aniversari.cpp:15:32: error: no match for 'operator=' (operand types are 'varsta' and 'int') {if(a[i].an>ma.an){ma=a[i];ima=i;} ^ aniversari.cpp:15:32: note: candidates are: aniversari.cpp:3:8: note: varsta& varsta::operator=(const varsta&) struct varsta { ^ aniversari.cpp:3:8: note: no known conversion for argument 1 from 'int' to 'const varsta&' aniversari.cpp:3:8: note: varsta& varsta::operator=(varsta&&) aniversari.cpp:3:8: note: no known conversion for argument 1 from 'int' to 'varsta&&' aniversari.cpp:18:41: error: no match for 'operator=' (operand types are 'varsta' and 'int') if(a[i].luna>ma.luna){ma=a[i];ima=i;} ^ aniversari.cpp:18:41: note: candidates are: aniversari.cpp:3:8: note: varsta& varsta::operator=(const varsta&) struct varsta { ^ aniversari.cpp:3:8: note: no known conversion for argument 1 from 'int' to 'const varsta&' aniversari.cpp:3:8: note: varsta& varsta::operator=(varsta&&) aniversari.cpp:3:8: note: no known conversion for argument 1 from 'int' to 'varsta&&' aniversari.cpp:19:59: error: no match for 'operator=' (operand types are 'varsta' and 'int') else if(a[i].luna==ma.luna && a[i].zi>ma.zi){ma=a[i];ima=i;} ^ aniversari.cpp:19:59: note: candidates are: aniversari.cpp:3:8: note: varsta& varsta::operator=(const varsta&) struct varsta { ^ aniversari.cpp:3:8: note: no known conversion for argument 1 from 'int' to 'const varsta&' aniversari.cpp:3:8: note: varsta& varsta::operator=(varsta&&) aniversari.cpp:3:8: note: no known conversion for argument 1 from 'int' to 'varsta&&' aniversari.cpp:17:9: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses] if(a[i].an==ma.an) ^ aniversari.cpp:21:31: error: no match for 'operator=' (operand types are 'varsta' and 'int') if(a[i].an>mi.an){mi=a[i];imi=i;} ^ aniversari.cpp:21:31: note: candidates are: aniversari.cpp:3:8: note: varsta& varsta::operator=(const varsta&) struct varsta { ^ aniversari.cpp:3:8: note: no known conversion for argument 1 from 'int' to 'const varsta&' aniversari.cpp:3:8: note: varsta& varsta::operator=(varsta&&) aniversari.cpp:3:8: note: no known conversion for argument 1 from 'int' to 'varsta&&' aniversari.cpp:24:41: error: no match for 'operator=' (operand types are 'varsta' and 'int') if(a[i].luna>mi.luna){mi=a[i];imi=i;} ^ aniversari.cpp:24:41: note: candidates are: aniversari.cpp:3:8: note: varsta& varsta::operator=(const varsta&) struct varsta { ^ aniversari.cpp:3:8: note: no known conversion for argument 1 from 'int' to 'const varsta&' aniversari.cpp:3:8: note: varsta& varsta::operator=(varsta&&) aniversari.cpp:3:8: note: no known conversion for argument 1 from 'int' to 'varsta&&' aniversari.cpp:25:59: error: no match for 'operator=' (operand types are 'varsta' and 'int') else if(a[i].luna==mi.luna && a[i].zi>mi.zi){mi=a[i];imi=i;}} cout<<imi<<" "<<ima; ^ aniversari.cpp:25:59: note: candidates are: aniversari.cpp:3:8: note: varsta& varsta::operator=(const varsta&) struct varsta { ^ aniversari.cpp:3:8: note: no known conversion for argument 1 from 'int' to 'const varsta&' aniversari.cpp:3:8: note: varsta& varsta::operator=(varsta&&) aniversari.cpp:3:8: note: no known conversion for argument 1 from 'int' to 'varsta&&' aniversari.cpp:23:9: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses] if(a[i].an==mi.an) ^ aniversari.cpp:25:71: error: cannot bind 'std::ostream {aka std::basic_ostream<char>}' lvalue to 'std::basic_ostream<char>&&' else if(a[i].luna==mi.luna && a[i].zi>mi.zi){mi=a[i];imi=i;}} cout<<imi<<" "<<ima; ^ In file included from /usr/include/c++/4.8/iostream:39:0, from aniversari.cpp:1: /usr/include/c++/4.8/ostream:602:5: error: initializing argument 1 of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&&, const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Tp = varsta]' operator<<(basic_ostream<_CharT, _Traits>&& __os, const _Tp& __x) ^ aniversari.cpp:25:84: error: expected '}' at end of input else if(a[i].luna==mi.luna && a[i].zi>mi.zi){mi=a[i];imi=i;}} cout<<imi<<" "<<ima; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Aniversari 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ă.