Detalii evaluare #64814195

Rezumat problemă

#4756

Se citește un text format din cuvinte și separatori. Cuvintele sunt formate din litere mici ale alfabetului, iar separatorii sunt spațiul, plus caracterele din șirul '.,!?:;-.
1) Să se afișeze n – numărul de cuvinte, precum și cuvintele din text.
2) Se se afișeze cuvântul cel mai mic din punct de vedere lexicografic.
3) Să se determine numărul de cuvinte care conțin secvența ini.
4) Să se afișeze fiecare cuvânt oglindit.
5) Să se determine câte cuvinte se termină cu litera a.
6) Să se determine lungimea minimă și lungimea maximă a unui cuvânt

Detalii

Problema textcuv Operații I/O textcuv.in/textcuv.out
Limita timp 0.1 secunde Limita memorie Total: 16 MB / Stivă 8 MB
Id soluție #64814195 Utilizator daria daria (daria234)
Fișier textcuv.cpp Dimensiune 1.79 KB
Data încărcării 03 Iunie 2026, 08:58 Scor/rezultat Eroare de compilare

Evaluare

Mesaj compilare

textcuv.cpp:4:1: error: ‘ifstream’ does not name a type
    4 | ifstream fin("textcuv.in");
      | ^~~~~~~~
textcuv.cpp:5:1: error: ‘ofstream’ does not name a type
    5 | ofstream fout("textcuv.out");
      | ^~~~~~~~
textcuv.cpp: In function ‘int main()’:
textcuv.cpp:9:5: error: ‘fin’ was not declared in this scope
    9 |     fin>>T;
      |     ^~~
textcuv.cpp:11:18: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
   11 |     for(int i=0;i<strlen(a);i++)
      |                 ~^~~~~~~~~~
textcuv.cpp:14:9: error: ‘fout’ was not declared in this scope
   14 |         fout<<a[i]<<"\n";}
      |         ^~~~
textcuv.cpp:17:26: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
   17 |             for(int i=0;i<strlen(a)-1;i++){
      |                         ~^~~~~~~~~~~~
textcuv.cpp:18:30: warning: comparison of integer expressions of different signedness: ‘int’ and ‘size_t’ {aka ‘long unsigned int’} [-Wsign-compare]
   18 |                 for(int j=0;j<strlen(a)-i-1;j++){
      |                             ~^~~~~~~~~~~~~~
textcuv.cpp:24:17: error: ‘fout’ was not declared in this scope
   24 |                 fout<<a[0][0];}
      |                 ^~~~
textcuv.cpp:24:27: error: invalid types ‘char[int]’ for array subscript
   24 |                 fout<<a[0][0];}
      |                           ^
textcuv.cpp:25:13: error: expected ‘}’ before ‘else’
   25 |             else{
      |             ^~~~
textcuv.cpp:16:17: note: to match this ‘{’
   16 |         if(T==2){
      |                 ^
textcuv.cpp:28:37: error: invalid conversion from ‘char*’ to ‘int’ [-fpermissive]
   28 |                     if(strchr("ini",a)!=NULL)x++;
      |                                     ^
      |                                     |
      |                                     char*
In file included from /usr/include/c++/13/cstring:42,
                 from textcuv.cpp:2:
/usr/include/string.h:239:30: note:   initializing argument 2 of ‘const char* strchr(const char*, int)’
  239 | strchr (const char *__s, int __c) __THROW
      |                          ~~~~^~~
textcuv.cpp:29:21: error: ‘fout’ was not declared in this scope
   29 |                     fout<<x;
      |                     ^~~~
textcuv.cpp:32:43: error: invalid conversion from ‘char’ to ‘const char*’ [-fpermissive]
   32 |                     int dreapta=strlen(a[i])-1;
      |                                        ~~~^
      |                                           |
      |                                           char
/usr/include/string.h:407:35: note:   initializing argument 1 of ‘size_t strlen(const char*)’
  407 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~
textcuv.cpp:40:21: error: ‘fout’ was not declared in this scope
   40 |                     fout<<a<<"\n";
      |                     ^~~~
textcuv.cpp:42:33: error: invalid conversion from ‘char’ to ‘const char*’ [-fpermissive]
   42 |                     k=strlen(a[i]);
      |                              ~~~^
      |                                 |
      |                                 char
/usr/include/string.h:407:35: note:   initializing argument 1 of ‘size_t strlen(const char*)’
  407 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~
textcuv.cpp:43:24: warning: init-statement in selection statements only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
   43 |                     if(a[k-1]=='a';
      |                        ^
textcuv.cpp:43:30: warning: statement has no effect [-Wunused-value]
   43 |                     if(a[k-1]=='a';
      |                        ~~~~~~^~~~~
textcuv.cpp:44:24: error: ‘fout’ was not declared in this scope
   44 |                        fout<<a[k-1]<<" ";}
      |                        ^~~~
textcuv.cpp:44:41: error: expected ‘)’ before ‘;’ token
   44 |                        fout<<a[k-1]<<" ";}
      |                                         ^
      |                                         )
textcuv.cpp:43:23: note: to match this ‘(’
   43 |                     if(a[k-1]=='a';
      |                       ^
textcuv.cpp:48:41: error: invalid conversion from ‘char’ to ‘const char*’ [-fpermissive]
   48 |                            if(strlen(a[i])<min){
      |                                      ~~~^
      |                                         |
      |                                         char
/usr/include/string.h:407:35: note:   initializing argument 1 of ‘size_t strlen(const char*)’
  407 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~
textcuv.cpp:48:43: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]
   48 |                            if(strlen(a[i])<min){
      |                               ~~~~~~~~~~~~^~~~
textcuv.cpp:49:46: error: invalid conversion from ‘char’ to ‘const char*’ [-fpermissive]
   49 |                                min=strlen(a[i]);}
      |                                           ~~~^
      |                                              |
      |                                              char
/usr/include/string.h:407:35: note:   initializing argument 1 of ‘size_t strlen(const char*)’
  407 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~
textcuv.cpp:50:41: error: invalid conversion from ‘char’ to ‘const char*’ [-fpermissive]
   50 |                            if(strlen(a[i])>max){
      |                                      ~~~^
      |                                         |
      |                                         char
/usr/include/string.h:407:35: note:   initializing argument 1 of ‘size_t strlen(const char*)’
  407 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~
textcuv.cpp:50:43: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘int’ [-Wsign-compare]
   50 |                            if(strlen(a[i])>max){
      |                               ~~~~~~~~~~~~^~~~
textcuv.cpp:51:46: error: invalid conversion from ‘char’ to ‘const char*’ [-fpermissive]
   51 |                                max=strlen(a[i]);}
      |                                           ~~~^
      |                                              |
      |                                              char
/usr/include/string.h:407:35: note:   initializing argument 1 of ‘size_t strlen(const char*)’
  407 | extern size_t strlen (const char *__s)
      |                       ~~~~~~~~~~~~^~~
textcuv.cpp:52:28: error: ‘fout’ was not declared in this scope
   52 |                            fout<<min<<" "<<max;}
      |                            ^~~~
textcuv.cpp:55:25: error: expected ‘}’ at end of input
   55 |                        }
      |                         ^
textcuv.cpp:30:22: note: to match this ‘{’
   30 |                 }else{if(T==4){
      |                      ^
textcuv.cpp:55:25: error: expected ‘}’ at end of input
   55 |                        }
      |                         ^
textcuv.cpp:25:17: note: to match this ‘{’
   25 |             else{
      |                 ^
textcuv.cpp:55:25: error: expected ‘}’ at end of input
   55 |                        }
      |                         ^
textcuv.cpp:15:9: note: to match this ‘{’
   15 |     else{
      |         ^
textcuv.cpp:55:25: error: expected ‘}’ at end of input
   55 |                        }
      |                         ^
textcuv.cpp:6:11: note: to match this ‘{’
    6 | int main(){
      |           ^

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 textcuv 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!