Detalii evaluare #62359647

Rezumat problemă

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.

Detalii

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 Cretu Adina (Adina_2009)
Fișier aniversari.cpp Dimensiune 655 B
Data încărcării 19 Ianuarie 2026, 11:50 Scor/rezultat Eroare de compilare

Evaluare

Mesaj 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;

                                                                                    ^

Cum funcționează evaluarea?

www.pbinfo.ro permite evaluarea a două tipuri de probleme:

  • probleme la care rezolvarea presupune scrierea unui program complet
  • probleme la care rezolvarea presupune scrierea unei secvențe de program - câteva instrucțiuni, o listă de declarații, una sau mai multe funcții, etc.

Problema Aniversari face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:

  • Programul sursă este compilat folosind compilatorul corespunzător. Dacă în urma compilării se obțin erori sau avertismente, acestea sunt afișate în această pagină.
  • Dacă programul a fost compilat, executabilul obținut va fi rulat, furnizându-i-se unul sau mai multe seturi de date de intrare, în concordanță cu restricțiile specifice problemei. Pentru fiecare set de date se obține un anumit punctaj, în raport cu corectitudinea soluției tale.

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ă.

Du-te sus!