Detalii evaluare #60163799

Rezumat problemă

Ai primit definiția unei clase. Implementează toate metodele clasei.

Detalii

Problema oop_numere_complexe Operații I/O tastatură/ecran
Limita timp 0.1 secunde Limita memorie Total: 64 MB / Stivă 8 MB
Id soluție #60163799 Utilizator Dumea Dragoș (DumeaDragos)
Fișier oop_numere_complexe.cpp Dimensiune 4.10 KB
Data încărcării 20 Octombrie 2025, 12:50 Scor/rezultat Eroare de compilare

Evaluare

Mesaj compilare

oop_numere_complexe.cpp:31:7: error: expected nested-name-specifier before 'System'
 using System;

       ^
oop_numere_complexe.cpp:31:7: error: 'System' has not been declared
oop_numere_complexe.cpp:32:7: error: expected nested-name-specifier before 'System'
 using System.Collections.Generic;

       ^
oop_numere_complexe.cpp:32:7: error: 'System' has not been declared
oop_numere_complexe.cpp:32:13: error: expected ';' before '.' token
 using System.Collections.Generic;

             ^
oop_numere_complexe.cpp:32:13: error: expected unqualified-id before '.' token
oop_numere_complexe.cpp:33:7: error: expected nested-name-specifier before 'System'
 using System.Linq;

       ^
oop_numere_complexe.cpp:33:7: error: 'System' has not been declared
oop_numere_complexe.cpp:33:13: error: expected ';' before '.' token
 using System.Linq;

             ^
oop_numere_complexe.cpp:33:13: error: expected unqualified-id before '.' token
oop_numere_complexe.cpp:34:7: error: expected nested-name-specifier before 'System'
 using System.Text;

       ^
oop_numere_complexe.cpp:34:7: error: 'System' has not been declared
oop_numere_complexe.cpp:34:13: error: expected ';' before '.' token
 using System.Text;

             ^
oop_numere_complexe.cpp:34:13: error: expected unqualified-id before '.' token
oop_numere_complexe.cpp:35:7: error: expected nested-name-specifier before 'System'
 using System.Threading.Tasks;

       ^
oop_numere_complexe.cpp:35:7: error: 'System' has not been declared
oop_numere_complexe.cpp:35:13: error: expected ';' before '.' token
 using System.Threading.Tasks;

             ^
oop_numere_complexe.cpp:35:13: error: expected unqualified-id before '.' token
oop_numere_complexe.cpp:41:16: error: expected ':' before 'int'
         public int i, r;

                ^
oop_numere_complexe.cpp:42:16: error: expected ':' before 'Complex'
         public Complex(int pr,int pi)

                ^
oop_numere_complexe.cpp:47:16: error: expected ':' before 'Complex'
         public Complex()

                ^
oop_numere_complexe.cpp:51:16: error: expected ':' before 'void'
         public void set(int pr,int pi)

                ^
oop_numere_complexe.cpp:56:16: error: expected ':' before 'double'
         public double modul()

                ^
oop_numere_complexe.cpp:60:16: error: expected ':' before 'int'
         public int real()

                ^
oop_numere_complexe.cpp:64:16: error: expected ':' before 'int'
         public int imag()

                ^
oop_numere_complexe.cpp:68:16: error: expected ':' before 'virtual'
         public virtual string afis()

                ^
oop_numere_complexe.cpp:85:16: error: expected ':' before 'static'
         public static Complex operator +(Complex c1, Complex c2)

                ^
oop_numere_complexe.cpp:85:64: error: 'static pbinfo_3539::Complex pbinfo_3539::Complex::operator+(pbinfo_3539::Complex, pbinfo_3539::Complex)' must be either a non-static member function or a non-member function
         public static Complex operator +(Complex c1, Complex c2)

                                                                ^
oop_numere_complexe.cpp:92:16: error: expected ':' before 'static'
         public static Complex operator -(Complex c1, Complex c2)

                ^
oop_numere_complexe.cpp:92:64: error: 'static pbinfo_3539::Complex pbinfo_3539::Complex::operator-(pbinfo_3539::Complex, pbinfo_3539::Complex)' must be either a non-static member function or a non-member function
         public static Complex operator -(Complex c1, Complex c2)

                                                                ^
oop_numere_complexe.cpp:99:16: error: expected ':' before 'static'
         public static Complex operator *(Complex c1, Complex c2)

                ^
oop_numere_complexe.cpp:99:64: error: 'static pbinfo_3539::Complex pbinfo_3539::Complex::operator*(pbinfo_3539::Complex, pbinfo_3539::Complex)' must be either a non-static member function or a non-member function
         public static Complex operator *(Complex c1, Complex c2)

                                                                ^
oop_numere_complexe.cpp:106:16: error: expected ':' before 'static'
         public static bool operator <(Complex c1,Complex c2)

                ^
oop_numere_complexe.cpp:106:60: error: 'static bool pbinfo_3539::Complex::operator<(pbinfo_3539::Complex, pbinfo_3539::Complex)' must be either a non-static member function or a non-member function
         public static bool operator <(Complex c1,Complex c2)

                                                            ^
oop_numere_complexe.cpp:110:16: error: expected ':' before 'static'
         public static bool operator >(Complex c1,Complex c2)

                ^
oop_numere_complexe.cpp:110:60: error: 'static bool pbinfo_3539::Complex::operator>(pbinfo_3539::Complex, pbinfo_3539::Complex)' must be either a non-static member function or a non-member function
         public static bool operator >(Complex c1,Complex c2)

                                                            ^
oop_numere_complexe.cpp:114:16: error: expected ':' before 'static'
         public static bool operator ==(Complex c1,Complex c2)

                ^
oop_numere_complexe.cpp:114:61: error: 'static bool pbinfo_3539::Complex::operator==(pbinfo_3539::Complex, pbinfo_3539::Complex)' must be either a non-static member function or a non-member function
         public static bool operator ==(Complex c1,Complex c2)

                                                             ^
oop_numere_complexe.cpp:120:16: error: expected ':' before 'static'
         public static bool operator !=(Complex c1, Complex c2)

                ^
oop_numere_complexe.cpp:120:62: error: 'static bool pbinfo_3539::Complex::operator!=(pbinfo_3539::Complex, pbinfo_3539::Complex)' must be either a non-static member function or a non-member function
         public static bool operator !=(Complex c1, Complex c2)

                                                              ^
oop_numere_complexe.cpp:126:5: error: expected ';' after class definition
     }

     ^
oop_numere_complexe.cpp: In member function 'double pbinfo_3539::Complex::modul()':
oop_numere_complexe.cpp:58:20: error: 'Math' was not declared in this scope
             return Math.Sqrt(Math.Pow(r, 2) + Math.Pow(i, 2));

                    ^
oop_numere_complexe.cpp: In member function 'virtual std::string pbinfo_3539::Complex::afis()':
oop_numere_complexe.cpp:71:26: error: request for member 'ToString' in '((pbinfo_3539::Complex*)this)->pbinfo_3539::Complex::r', which is of non-class type 'int'
                 return r.ToString() + "+" + i.ToString() + "i";

                          ^
oop_numere_complexe.cpp:71:47: error: request for member 'ToString' in '((pbinfo_3539::Complex*)this)->pbinfo_3539::Complex::i', which is of non-class type 'int'
                 return r.ToString() + "+" + i.ToString() + "i";

                                               ^
oop_numere_complexe.cpp:75:30: error: request for member 'ToString' in '((pbinfo_3539::Complex*)this)->pbinfo_3539::Complex::r', which is of non-class type 'int'
                     return r.ToString() + i.ToString() + "i";

                              ^
oop_numere_complexe.cpp:75:45: error: request for member 'ToString' in '((pbinfo_3539::Complex*)this)->pbinfo_3539::Complex::i', which is of non-class type 'int'
                     return r.ToString() + i.ToString() + "i";

                                             ^
oop_numere_complexe.cpp:78:30: error: request for member 'ToString' in '((pbinfo_3539::Complex*)this)->pbinfo_3539::Complex::r', which is of non-class type 'int'
                     return r.ToString();

                              ^
oop_numere_complexe.cpp:81:30: error: request for member 'ToString' in '((pbinfo_3539::Complex*)this)->pbinfo_3539::Complex::i', which is of non-class type 'int'
                     return i.ToString() + "i";

                              ^
oop_numere_complexe.cpp: At global scope:
oop_numere_complexe.cpp:129:16: error: expected ':' before 'Real'
         public Real(int pr):base(pr,0)

                ^
oop_numere_complexe.cpp:133:16: error: expected ':' before 'override'
         public override string ToString()

                ^
oop_numere_complexe.cpp:133:16: error: 'override' does not name a type
oop_numere_complexe.cpp:137:5: error: expected ';' after class definition
     }

     ^
oop_numere_complexe.cpp: In constructor 'pbinfo_3539::Real::Real(int)':
oop_numere_complexe.cpp:129:29: error: class 'pbinfo_3539::Real' does not have any field named 'base'
         public Real(int pr):base(pr,0)

                             ^
oop_numere_complexe.cpp: At global scope:
oop_numere_complexe.cpp:140:35: error: expected ',' or '...' before 'args'
         static void Main(string[] args)

                                   ^
oop_numere_complexe.cpp:175:5: error: expected ';' after class definition
     }

     ^
oop_numere_complexe.cpp: In static member function 'static void pbinfo_3539::Program::Main(std::string*)':
oop_numere_complexe.cpp:154:17: error: expected primary-expression before 'int'
             n = int.Parse(Console.ReadLine());

                 ^
oop_numere_complexe.cpp:154:17: error: expected ';' before 'int'
oop_numere_complexe.cpp:155:19: error: expected unqualified-id before '[' token
             string[] sep = new string[] { " " };

                   ^
oop_numere_complexe.cpp:156:19: error: expected unqualified-id before '[' token
             string[] citire;

                   ^
oop_numere_complexe.cpp:157:20: error: expected unqualified-id before '[' token
             Complex[] v = new Complex[n + 1];

                    ^
oop_numere_complexe.cpp:160:17: error: 'citire' was not declared in this scope
                 citire = Console.ReadLine().Split(sep, StringSplitOptions.RemoveEmptyEntries);

                 ^
oop_numere_complexe.cpp:160:26: error: 'Console' was not declared in this scope
                 citire = Console.ReadLine().Split(sep, StringSplitOptions.RemoveEmptyEntries);

                          ^
oop_numere_complexe.cpp:160:51: error: 'sep' was not declared in this scope
                 citire = Console.ReadLine().Split(sep, StringSplitOptions.RemoveEmptyEntries);

                                                   ^
oop_numere_complexe.cpp:160:56: error: 'StringSplitOptions' was not declared in this scope
                 citire = Console.ReadLine().Split(sep, StringSplitOptions.RemoveEmptyEntries);

                                                        ^
oop_numere_complexe.cpp:161:17: error: 'v' was not declared in this scope
                 v[i] = new Complex(int.Parse(citire[0]), int.Parse(citire[1]));

                 ^
oop_numere_complexe.cpp:161:36: error: expected primary-expression before 'int'
                 v[i] = new Complex(int.Parse(citire[0]), int.Parse(citire[1]));

                                    ^
oop_numere_complexe.cpp:161:58: error: expected primary-expression before 'int'
                 v[i] = new Complex(int.Parse(citire[0]), int.Parse(citire[1]));

                                                          ^
oop_numere_complexe.cpp:165:24: error: 'v' was not declared in this scope
                     if(v[i]>v[j])

                        ^
oop_numere_complexe.cpp:172:17: error: 'Console' was not declared in this scope
                 Console.WriteLine(v[i].afis());

                 ^
oop_numere_complexe.cpp:172:35: error: 'v' was not declared in this scope
                 Console.WriteLine(v[i].afis());

                                   ^
oop_numere_complexe.cpp:173:13: error: 'Console' was not declared in this scope
             Console.ReadLine();

             ^
oop_numere_complexe.cpp: In member function 'virtual std::string pbinfo_3539::Complex::afis()':
oop_numere_complexe.cpp:84:9: warning: control reaches end of non-void function [-Wreturn-type]
         }

         ^

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 oop_numere_complexe face parte din a doua categorie. Pentru aceste probleme se folosește un program suport, furnizat de propunătorul problemei. Soluția propusă de tine va fi evaluată astfel:

  • Soluția propusă de tine este inclusă în programul suport, apoi acesta este compilat. Dacă în urma compilării se obțin erori sau avertismente, acestea sunt afișate în această pagină.
  • Datorită existenței programului suport, la compilare pot să apară erori sau avertismente care să nu se refere la instrucțiunile scrise de tine, dar care sunt datorate faptului că soluția ta nu este corectă.
  • Dacă programul suport 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!