Detalii evaluare #53614044

Rezumat problemă

Să se scrie un program care citește un șir de paranteze rotunde care se închid corect (corect parantezat) în care parantezele deschise sunt numerotate de la stânga la dreapta, începând de la 1, și determină pentru fiecare paranteză închisă numărul de ordine al parantezei deschise corespunzătoare.

Detalii

Problema Paranteze4 Operații I/O tastatură/ecran
Limita timp 0.1 secunde Limita memorie Total: 64 MB / Stivă 8 MB
Id soluție #53614044 Utilizator Voc Denis (Denis_Voc)
Fișier paranteze4.cpp Dimensiune 607 B
Data încărcării 06 Noiembrie 2024, 15:06 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

paranteze4.cpp: In function 'int main()':
paranteze4.cpp:15:18: error: no matching function for call to 'std::basic_ifstream<char>::get(char [256])'
         fin.get(x);

                  ^
paranteze4.cpp:15:18: note: candidates are:
In file included from /usr/include/c++/4.8/iostream:40:0,
                 from paranteze4.cpp:1:
/usr/include/c++/4.8/istream:302:7: note: std::basic_istream<_CharT, _Traits>::int_type std::basic_istream<_CharT, _Traits>::get() [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::int_type = int]
       get();
       ^
/usr/include/c++/4.8/istream:302:7: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/4.8/istream:316:7: note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::get(std::basic_istream<_CharT, _Traits>::char_type&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::char_type = char]
       get(char_type& __c);
       ^
/usr/include/c++/4.8/istream:316:7: note:   no known conversion for argument 1 from 'char [256]' to 'std::basic_istream<char>::char_type& {aka char&}'
/usr/include/c++/4.8/istream:343:7: note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::get(std::basic_istream<_CharT, _Traits>::char_type*, std::streamsize, std::basic_istream<_CharT, _Traits>::char_type) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::char_type = char; std::streamsize = int]
       get(char_type* __s, streamsize __n, char_type __delim);
       ^
/usr/include/c++/4.8/istream:343:7: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/4.8/istream:354:7: note: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::get(std::basic_istream<_CharT, _Traits>::char_type*, std::streamsize) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>; std::basic_istream<_CharT, _Traits>::char_type = char; std::streamsize = int]
       get(char_type* __s, streamsize __n)
       ^
/usr/include/c++/4.8/istream:354:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/4.8/istream:377:7: note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::get(std::basic_istream<_CharT, _Traits>::__streambuf_type&, std::basic_istream<_CharT, _Traits>::char_type) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__streambuf_type = std::basic_streambuf<char>; std::basic_istream<_CharT, _Traits>::char_type = char]
       get(__streambuf_type& __sb, char_type __delim);
       ^
/usr/include/c++/4.8/istream:377:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/4.8/istream:387:7: note: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::get(std::basic_istream<_CharT, _Traits>::__streambuf_type&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>; std::basic_istream<_CharT, _Traits>::__streambuf_type = std::basic_streambuf<char>]
       get(__streambuf_type& __sb)
       ^
/usr/include/c++/4.8/istream:387:7: note:   no known conversion for argument 1 from 'char [256]' to 'std::basic_istream<char>::__streambuf_type& {aka std::basic_streambuf<char>&}'
paranteze4.cpp:16:18: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
         while(x!='\n')

                  ^
paranteze4.cpp:18:19: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
             if(x=='(')

                   ^
paranteze4.cpp:29:22: error: no matching function for call to 'std::basic_ifstream<char>::get(char [256])'
             fin.get(x);

                      ^
paranteze4.cpp:29:22: note: candidates are:
In file included from /usr/include/c++/4.8/iostream:40:0,
                 from paranteze4.cpp:1:
/usr/include/c++/4.8/istream:302:7: note: std::basic_istream<_CharT, _Traits>::int_type std::basic_istream<_CharT, _Traits>::get() [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::int_type = int]
       get();
       ^
/usr/include/c++/4.8/istream:302:7: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/4.8/istream:316:7: note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::get(std::basic_istream<_CharT, _Traits>::char_type&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::char_type = char]
       get(char_type& __c);
       ^
/usr/include/c++/4.8/istream:316:7: note:   no known conversion for argument 1 from 'char [256]' to 'std::basic_istream<char>::char_type& {aka char&}'
/usr/include/c++/4.8/istream:343:7: note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::get(std::basic_istream<_CharT, _Traits>::char_type*, std::streamsize, std::basic_istream<_CharT, _Traits>::char_type) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::char_type = char; std::streamsize = int]
       get(char_type* __s, streamsize __n, char_type __delim);
       ^
/usr/include/c++/4.8/istream:343:7: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/4.8/istream:354:7: note: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::get(std::basic_istream<_CharT, _Traits>::char_type*, std::streamsize) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>; std::basic_istream<_CharT, _Traits>::char_type = char; std::streamsize = int]
       get(char_type* __s, streamsize __n)
       ^
/usr/include/c++/4.8/istream:354:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/4.8/istream:377:7: note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::get(std::basic_istream<_CharT, _Traits>::__streambuf_type&, std::basic_istream<_CharT, _Traits>::char_type) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__streambuf_type = std::basic_streambuf<char>; std::basic_istream<_CharT, _Traits>::char_type = char]
       get(__streambuf_type& __sb, char_type __delim);
       ^
/usr/include/c++/4.8/istream:377:7: note:   candidate expects 2 arguments, 1 provided
/usr/include/c++/4.8/istream:387:7: note: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::get(std::basic_istream<_CharT, _Traits>::__streambuf_type&) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>; std::basic_istream<_CharT, _Traits>::__streambuf_type = std::basic_streambuf<char>]
       get(__streambuf_type& __sb)
       ^
/usr/include/c++/4.8/istream:387:7: note:   no known conversion for argument 1 from 'char [256]' to 'std::basic_istream<char>::__streambuf_type& {aka std::basic_streambuf<char>&}'

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