#2997
prescurtat
C++
Scrieți funcția cu următorul antet:
void Prescurtat(char s[])
Funcția primește ca parametru un text de cel mult 50
de caractere, alcătuit din cuvinte separate prin câte un spațiu și formate din litere mari ale alfabetului englez, urmate eventual de caracterul .
(punct), dacă sunt scrise prescurtat. Textul reprezintă numele unei instituții de învățământ și doar cuvintele din mulțimea {COLEGIUL
, LICEUL
, NATIONAL
, TEORETIC
} pot fi prescurtate, eliminându-se ultimele lor litere. Funcția va returna tot prin intermediul parametrului s
numele instituției scris fără prescurtări.
Simulare bacalaureat 2019
Problema | prescurtat | Operații I/O |
prescurtat.in /prescurtat.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #54888878 | Utilizator | |
Fișier | prescurtat.cpp | Dimensiune | 562 B |
Data încărcării | 11 Decembrie 2024, 12:43 | Scor / rezultat | Eroare de compilare |
prescurtat.cpp: In function 'void prescurtat(char*)': prescurtat.cpp:8:43: error: invalid conversion from 'char' to 'char*' [-fpermissive] if (s[0] == 'C') strcat(v, "COLEGIUL "); ^ In file included from /usr/include/features.h:374:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/os_defines.h:39, from /usr/include/i386-linux-gnu/c++/4.8/bits/c++config.h:426, from /usr/include/c++/4.8/iosfwd:38, from /usr/include/c++/4.8/ios:38, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from prescurtat.cpp:1: /usr/include/i386-linux-gnu/bits/string3.h:140:1: error: initializing argument 1 of 'char* strcat(char*, const char*)' [-fpermissive] __NTH (strcat (char *__restrict __dest, const char *__restrict __src)) ^ prescurtat.cpp:9:46: error: invalid conversion from 'char' to 'char*' [-fpermissive] else if (s[0] == 'L') strcat(v, "LICEUL "); ^ In file included from /usr/include/features.h:374:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/os_defines.h:39, from /usr/include/i386-linux-gnu/c++/4.8/bits/c++config.h:426, from /usr/include/c++/4.8/iosfwd:38, from /usr/include/c++/4.8/ios:38, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from prescurtat.cpp:1: /usr/include/i386-linux-gnu/bits/string3.h:140:1: error: initializing argument 1 of 'char* strcat(char*, const char*)' [-fpermissive] __NTH (strcat (char *__restrict __dest, const char *__restrict __src)) ^ prescurtat.cpp:10:48: error: invalid conversion from 'char' to 'char*' [-fpermissive] else if (s[0] == 'N') strcat(v, "NATIONAL "); ^ In file included from /usr/include/features.h:374:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/os_defines.h:39, from /usr/include/i386-linux-gnu/c++/4.8/bits/c++config.h:426, from /usr/include/c++/4.8/iosfwd:38, from /usr/include/c++/4.8/ios:38, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from prescurtat.cpp:1: /usr/include/i386-linux-gnu/bits/string3.h:140:1: error: initializing argument 1 of 'char* strcat(char*, const char*)' [-fpermissive] __NTH (strcat (char *__restrict __dest, const char *__restrict __src)) ^ prescurtat.cpp:11:31: error: invalid conversion from 'char' to 'char*' [-fpermissive] else strcat(v, "TEORETIC "); ^ In file included from /usr/include/features.h:374:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/os_defines.h:39, from /usr/include/i386-linux-gnu/c++/4.8/bits/c++config.h:426, from /usr/include/c++/4.8/iosfwd:38, from /usr/include/c++/4.8/ios:38, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from prescurtat.cpp:1: /usr/include/i386-linux-gnu/bits/string3.h:140:1: error: initializing argument 1 of 'char* strcat(char*, const char*)' [-fpermissive] __NTH (strcat (char *__restrict __dest, const char *__restrict __src)) ^ prescurtat.cpp:12:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 1; i < strlen(s); i++) ^ prescurtat.cpp:16:53: error: invalid conversion from 'char' to 'char*' [-fpermissive] if (s[i+2] == 'C') strcat(v, "COLEGIUL "); ^ In file included from /usr/include/features.h:374:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/os_defines.h:39, from /usr/include/i386-linux-gnu/c++/4.8/bits/c++config.h:426, from /usr/include/c++/4.8/iosfwd:38, from /usr/include/c++/4.8/ios:38, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from prescurtat.cpp:1: /usr/include/i386-linux-gnu/bits/string3.h:140:1: error: initializing argument 1 of 'char* strcat(char*, const char*)' [-fpermissive] __NTH (strcat (char *__restrict __dest, const char *__restrict __src)) ^ prescurtat.cpp:17:56: error: invalid conversion from 'char' to 'char*' [-fpermissive] else if (s[i+2] == 'L') strcat(v, "LICEUL "); ^ In file included from /usr/include/features.h:374:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/os_defines.h:39, from /usr/include/i386-linux-gnu/c++/4.8/bits/c++config.h:426, from /usr/include/c++/4.8/iosfwd:38, from /usr/include/c++/4.8/ios:38, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from prescurtat.cpp:1: /usr/include/i386-linux-gnu/bits/string3.h:140:1: error: initializing argument 1 of 'char* strcat(char*, const char*)' [-fpermissive] __NTH (strcat (char *__restrict __dest, const char *__restrict __src)) ^ prescurtat.cpp:18:58: error: invalid conversion from 'char' to 'char*' [-fpermissive] else if (s[i+2] == 'N') strcat(v, "NATIONAL "); ^ In file included from /usr/include/features.h:374:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/os_defines.h:39, from /usr/include/i386-linux-gnu/c++/4.8/bits/c++config.h:426, from /usr/include/c++/4.8/iosfwd:38, from /usr/include/c++/4.8/ios:38, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from prescurtat.cpp:1: /usr/include/i386-linux-gnu/bits/string3.h:140:1: error: initializing argument 1 of 'char* strcat(char*, const char*)' [-fpermissive] __NTH (strcat (char *__restrict __dest, const char *__restrict __src)) ^ prescurtat.cpp:19:39: error: invalid conversion from 'char' to 'char*' [-fpermissive] else strcat(v, "TEORETIC "); ^ In file included from /usr/include/features.h:374:0, from /usr/include/i386-linux-gnu/c++/4.8/bits/os_defines.h:39, from /usr/include/i386-linux-gnu/c++/4.8/bits/c++config.h:426, from /usr/include/c++/4.8/iosfwd:38, from /usr/include/c++/4.8/ios:38, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from prescurtat.cpp:1: /usr/include/i386-linux-gnu/bits/string3.h:140:1: error: initializing argument 1 of 'char* strcat(char*, const char*)' [-fpermissive] __NTH (strcat (char *__restrict __dest, const char *__restrict __src)) ^ prescurtat.cpp:22:5: error: 'cout' was not declared in this scope cout << v; ^ prescurtat.cpp: In function 'int main()': prescurtat.cpp:31:17: error: 'Prescurtat' was not declared in this scope Prescurtat(s); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema prescurtat 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:
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ă.