#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 | #42396790 | Utilizator | |
Fișier | prescurtat.cpp | Dimensiune | 822 B |
Data încărcării | 04 Martie 2023, 14:18 | Scor / rezultat | Eroare de compilare |
prescurtat.cpp: In function 'void Prescurtat(char*)': prescurtat.cpp:11:17: error: invalid conversion from 'char' to 'const char*' [-fpermissive] strcat(s,'.'); ^ 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 2 of 'char* strcat(char*, const char*)' [-fpermissive] __NTH (strcat (char *__restrict __dest, const char *__restrict __src)) ^ prescurtat.cpp:13:13: error: 'C' was not declared in this scope cuv[0]={C,O,L,E,G,I,U,L}; ^ prescurtat.cpp:13:15: error: 'O' was not declared in this scope cuv[0]={C,O,L,E,G,I,U,L}; ^ prescurtat.cpp:13:17: error: 'L' was not declared in this scope cuv[0]={C,O,L,E,G,I,U,L}; ^ prescurtat.cpp:13:19: error: 'E' was not declared in this scope cuv[0]={C,O,L,E,G,I,U,L}; ^ prescurtat.cpp:13:21: error: 'G' was not declared in this scope cuv[0]={C,O,L,E,G,I,U,L}; ^ prescurtat.cpp:13:23: error: 'I' was not declared in this scope cuv[0]={C,O,L,E,G,I,U,L}; ^ prescurtat.cpp:13:25: error: 'U' was not declared in this scope cuv[0]={C,O,L,E,G,I,U,L}; ^ prescurtat.cpp:13:11: error: assigning to an array from an initializer list cuv[0]={C,O,L,E,G,I,U,L}; ^ prescurtat.cpp:14:11: error: assigning to an array from an initializer list cuv[1]={L,I,C,E,U,L}; ^ prescurtat.cpp:15:13: error: 'N' was not declared in this scope cuv[2]={N,A,T,I,O,N,A,L}; ^ prescurtat.cpp:15:15: error: 'A' was not declared in this scope cuv[2]={N,A,T,I,O,N,A,L}; ^ prescurtat.cpp:15:17: error: 'T' was not declared in this scope cuv[2]={N,A,T,I,O,N,A,L}; ^ prescurtat.cpp:15:11: error: assigning to an array from an initializer list cuv[2]={N,A,T,I,O,N,A,L}; ^ prescurtat.cpp:16:19: error: 'R' was not declared in this scope cuv[3]={T,E,O,R,E,T,I,C}; ^ prescurtat.cpp:16:11: error: assigning to an array from an initializer list cuv[3]={T,E,O,R,E,T,I,C}; ^ prescurtat.cpp:21:27: warning: converting to non-pointer type 'char' from NULL [-Wconversion-null] p[strlen(p)-1]=NULL; ^ prescurtat.cpp: In function 'int main()': prescurtat.cpp:38:8: error: 'C' was not declared in this scope s={C,O,L,E,G,., ,N,A,T,., ,D,E, ,I,N,F,O,R,M,A,T,I,C,A}; ^ prescurtat.cpp:38:10: error: 'O' was not declared in this scope s={C,O,L,E,G,., ,N,A,T,., ,D,E, ,I,N,F,O,R,M,A,T,I,C,A}; ^ prescurtat.cpp:38:12: error: 'L' was not declared in this scope s={C,O,L,E,G,., ,N,A,T,., ,D,E, ,I,N,F,O,R,M,A,T,I,C,A}; ^ prescurtat.cpp:38:14: error: 'E' was not declared in this scope s={C,O,L,E,G,., ,N,A,T,., ,D,E, ,I,N,F,O,R,M,A,T,I,C,A}; ^ prescurtat.cpp:38:16: error: 'G' was not declared in this scope s={C,O,L,E,G,., ,N,A,T,., ,D,E, ,I,N,F,O,R,M,A,T,I,C,A}; ^ prescurtat.cpp:38:18: error: expected primary-expression before '.' token s={C,O,L,E,G,., ,N,A,T,., ,D,E, ,I,N,F,O,R,M,A,T,I,C,A}; ^ prescurtat.cpp:38:19: error: expected unqualified-id before ',' token s={C,O,L,E,G,., ,N,A,T,., ,D,E, ,I,N,F,O,R,M,A,T,I,C,A}; ^ prescurtat.cpp:38:21: error: expected primary-expression before ',' token s={C,O,L,E,G,., ,N,A,T,., ,D,E, ,I,N,F,O,R,M,A,T,I,C,A}; ^ prescurtat.cpp:38:22: error: 'N' was not declared in this scope s={C,O,L,E,G,., ,N,A,T,., ,D,E, ,I,N,F,O,R,M,A,T,I,C,A}; ^ prescurtat.cpp:38:24: error: 'A' was not declared in this scope s={C,O,L,E,G,., ,N,A,T,., ,D,E, ,I,N,F,O,R,M,A,T,I,C,A}; ^ prescurtat.cpp:38:26: error: 'T' was not declared in this scope s={C,O,L,E,G,., ,N,A,T,., ,D,E, ,I,N,F,O,R,M,A,T,I,C,A}; ^ prescurtat.cpp:38:28: error: expected primary-expression before '.' token s={C,O,L,E,G,., ,N,A,T,., ,D,E, ,I,N,F,O,R,M,A,T,I,C,A}; ^ prescurtat.cpp:38:29: error: expected unqualified-id before ',' token s={C,O,L,E,G,., ,N,A,T,., ,D,E, ,I,N,F,O,R,M,A,T,I,C,A}; ^ prescurtat.cpp:38:31: error: expected primary-expression before ',' token s={C,O,L,E,G,., ,N,A,T,., ,D,E, ,I,N,F,O,R,M,A,T,I,C,A}; ^ prescurtat.cpp:38:32: error: 'D' was not declared in this scope s={C,O,L,E,G,., ,N,A,T,., ,D,E, ,I,N,F,O,R,M,A,T,I,C,A}; ^ prescurtat.cpp:38:37: error: expected primary-expression before ',' token s={C,O,L,E,G,., ,N,A,T,., ,D,E, ,I,N,F,O,R,M,A,T,I,C,A}; ^ prescurtat.cpp:38:38: error: 'I' was not declared in this scope s={C,O,L,E,G,., ,N,A,T,., ,D,E, ,I,N,F,O,R,M,A,T,I,C,A}; ^ prescurtat.cpp:38:42: error: 'F' was not declared in this scope s={C,O,L,E,G,., ,N,A,T,., ,D,E, ,I,N,F,O,R,M,A,T,I,C,A}; ^ prescurtat.cpp:38:46: error: 'R' was not declared in this scope s={C,O,L,E,G,., ,N,A,T,., ,D,E, ,I,N,F,O,R,M,A,T,I,C,A}; ^ prescurtat.cpp:38:48: error: 'M' was not declared in this scope s={C,O,L,E,G,., ,N,A,T,., ,D,E, ,I,N,F,O,R,M,A,T,I,C,A}; ^ prescurtat.cpp:38:6: error: assigning to an array from an initializer list s={C,O,L,E,G,., ,N,A,T,., ,D,E, ,I,N,F,O,R,M,A,T,I,C,A}; ^ prescurtat.cpp:40:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(i=0;i<strlen(s);i++) ^ prescurtat.cpp:41:14: warning: array subscript has type 'char' [-Wchar-subscripts] cout<<s[i]; ^ prescurtat.cpp: In function 'int main()': prescurtat.cpp:46:5: error: redefinition of 'int main()' int main() ^ prescurtat.cpp:36:5: error: 'int main()' previously defined here int main() ^
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ă.