#811
Scrieţi definiția completă a subprogramului C++ num care are 2 parametri: n – prin care primește un număr natural și v, prin care primeşte un tablou unidimensional cu n elemente, numere naturale cu cel mult 4 cifre.
Subprogramul înlocuieşte cu 0 fiecare valoare mai mică sau egală cu prima valoare din tablou. Tabloul modificat este furnizat tot prin parametrul v.
Variante Bacalaureat 2013
| Problema | Inlocuire0 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64758819 | Utilizator | |
| Fișier | inlocuire0.cpp | Dimensiune | 543 B |
| Data încărcării | 28 Mai 2026, 10:37 | Scor/rezultat | Eroare de compilare |
inlocuire0.cpp: In function ‘void Prescurtat(char*)’: inlocuire0.cpp:11:7: error: ‘strtok’ was not declared in this scope; did you mean ‘strtoq’? 11 | p=strtok(s, sep); | ^~~~~~ | strtoq inlocuire0.cpp:14:9: error: ‘strcpy’ was not declared in this scope 14 | strcpy(cuv, p); | ^~~~~~ inlocuire0.cpp:2:1: note: ‘strcpy’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’? 1 | #include <iostream> +++ |+#include <cstring> 2 | using namespace std; inlocuire0.cpp:15:9: error: ‘strchr’ was not declared in this scope 15 | if (strchr(cuv, '.')!=0) | ^~~~~~ inlocuire0.cpp:15:9: note: ‘strchr’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’? inlocuire0.cpp:17:26: error: ‘strcat’ was not declared in this scope 17 | if (cuv[0]=='C') strcat(nou,"COLEGIUL"); | ^~~~~~ inlocuire0.cpp:17:26: note: ‘strcat’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’? inlocuire0.cpp:18:26: error: ‘strcat’ was not declared in this scope 18 | if (cuv[0]=='L') strcat(nou,"LICEUL"); | ^~~~~~ inlocuire0.cpp:18:26: note: ‘strcat’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’? inlocuire0.cpp:19:26: error: ‘strcat’ was not declared in this scope 19 | if (cuv[0]=='N') strcat(nou,"NATIONAL"); | ^~~~~~ inlocuire0.cpp:19:26: note: ‘strcat’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’? inlocuire0.cpp:20:26: error: ‘strcat’ was not declared in this scope 20 | if (cuv[0]=='T') strcat(nou,"TEORETIC"); | ^~~~~~ inlocuire0.cpp:20:26: note: ‘strcat’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’? inlocuire0.cpp:22:10: error: ‘strcat’ was not declared in this scope 22 | else strcat (nou,cuv); | ^~~~~~ inlocuire0.cpp:22:10: note: ‘strcat’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’? inlocuire0.cpp:23:5: error: ‘strcat’ was not declared in this scope 23 | strcat(nou, " "); | ^~~~~~ inlocuire0.cpp:23:5: note: ‘strcat’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’? inlocuire0.cpp:27:9: error: ‘strlen’ was not declared in this scope 27 | nou[strlen(nou)-1]=0; | ^~~~~~ inlocuire0.cpp:27:9: note: ‘strlen’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’? inlocuire0.cpp:28:5: error: ‘strcpy’ was not declared in this scope 28 | strcpy(s,nou); | ^~~~~~ inlocuire0.cpp:28:5: note: ‘strcpy’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’? inlocuire0.cpp: In function ‘int main()’: inlocuire0.cpp:37:9: error: ‘num’ was not declared in this scope; did you mean ‘enum’? 37 | num(n , a); | ^~~ | enum
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Inlocuire0 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ă.