#129
Sortare
Să se scrie un program care ordonează descrescător elementele unui vector.
Problema | Sortare | Operații I/O |
sortare.in /sortare.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #32508154 | Utilizator | |
Fișier | sortare.cpp | Dimensiune | 1.84 KB |
Data încărcării | 17 Noiembrie 2021, 22:39 | Scor / rezultat | Eroare de compilare |
sortare.cpp:12:21: error: variable or field 'citire_dinamic' declared void void citire_dinamic(istream &f, TIP* vec, int dim) ^ sortare.cpp:12:21: error: 'istream' was not declared in this scope sortare.cpp:12:21: note: suggested alternative: In file included from /usr/include/c++/4.8/ios:38:0, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from sortare.cpp:1: /usr/include/c++/4.8/iosfwd:133:33: note: 'std::istream' typedef basic_istream<char> istream; ^ sortare.cpp:12:30: error: 'f' was not declared in this scope void citire_dinamic(istream &f, TIP* vec, int dim) ^ sortare.cpp:12:36: error: expected primary-expression before '*' token void citire_dinamic(istream &f, TIP* vec, int dim) ^ sortare.cpp:12:38: error: 'vec' was not declared in this scope void citire_dinamic(istream &f, TIP* vec, int dim) ^ sortare.cpp:12:43: error: expected primary-expression before 'int' void citire_dinamic(istream &f, TIP* vec, int dim) ^ sortare.cpp: In function 'int cautbin_poz_min_sir_descrescator(TIP, TIP*, int, int, bool)': sortare.cpp:22:51: error: there are no arguments to 'log2' that depend on a template parameter, so a declaration of 'log2' must be available [-fpermissive] int lg = pow(2, (int)log2(poz_fin - poz_start + 1)); ^ sortare.cpp:22:51: note: (if you use '-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated) sortare.cpp:22:52: error: there are no arguments to 'pow' that depend on a template parameter, so a declaration of 'pow' must be available [-fpermissive] int lg = pow(2, (int)log2(poz_fin - poz_start + 1)); ^ sortare.cpp: At global scope: sortare.cpp:56:22: error: variable or field 'afisare_dinamic' declared void void afisare_dinamic(ostream& g, TIP* vec, int dim, char separator = '\0') ^ sortare.cpp:56:22: error: 'ostream' was not declared in this scope sortare.cpp:56:22: note: suggested alternative: In file included from /usr/include/c++/4.8/ios:38:0, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from sortare.cpp:1: /usr/include/c++/4.8/iosfwd:136:33: note: 'std::ostream' typedef basic_ostream<char> ostream; ^ sortare.cpp:56:31: error: 'g' was not declared in this scope void afisare_dinamic(ostream& g, TIP* vec, int dim, char separator = '\0') ^ sortare.cpp:56:37: error: expected primary-expression before '*' token void afisare_dinamic(ostream& g, TIP* vec, int dim, char separator = '\0') ^ sortare.cpp:56:39: error: 'vec' was not declared in this scope void afisare_dinamic(ostream& g, TIP* vec, int dim, char separator = '\0') ^ sortare.cpp:56:44: error: expected primary-expression before 'int' void afisare_dinamic(ostream& g, TIP* vec, int dim, char separator = '\0') ^ sortare.cpp:56:53: error: expected primary-expression before 'char' void afisare_dinamic(ostream& g, TIP* vec, int dim, char separator = '\0') ^ sortare.cpp:66:22: error: variable or field 'afisare_dinamic' declared void void afisare_dinamic(ostream& g, TIP* vec, int dim, char separator = '\0') ^ sortare.cpp:66:22: error: 'ostream' was not declared in this scope sortare.cpp:66:22: note: suggested alternative: In file included from /usr/include/c++/4.8/ios:38:0, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from sortare.cpp:1: /usr/include/c++/4.8/iosfwd:136:33: note: 'std::ostream' typedef basic_ostream<char> ostream; ^ sortare.cpp:66:31: error: 'g' was not declared in this scope void afisare_dinamic(ostream& g, TIP* vec, int dim, char separator = '\0') ^ sortare.cpp:66:37: error: expected primary-expression before '*' token void afisare_dinamic(ostream& g, TIP* vec, int dim, char separator = '\0') ^ sortare.cpp:66:39: error: 'vec' was not declared in this scope void afisare_dinamic(ostream& g, TIP* vec, int dim, char separator = '\0') ^ sortare.cpp:66:44: error: expected primary-expression before 'int' void afisare_dinamic(ostream& g, TIP* vec, int dim, char separator = '\0') ^ sortare.cpp:66:53: error: expected primary-expression before 'char' void afisare_dinamic(ostream& g, TIP* vec, int dim, char separator = '\0') ^ sortare.cpp: In function 'int main()': sortare.cpp:79:2: error: 'ifstream' was not declared in this scope ifstream f("in.txt"); ^ sortare.cpp:79:2: note: suggested alternative: In file included from /usr/include/c++/4.8/ios:38:0, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from sortare.cpp:1: /usr/include/c++/4.8/iosfwd:157:34: note: 'std::ifstream' typedef basic_ifstream<char> ifstream; ^ sortare.cpp:79:11: error: expected ';' before 'f' ifstream f("in.txt"); ^ sortare.cpp:80:2: error: 'ofstream' was not declared in this scope ofstream g("out.txt"); ^ sortare.cpp:80:2: note: suggested alternative: In file included from /usr/include/c++/4.8/ios:38:0, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from sortare.cpp:1: /usr/include/c++/4.8/iosfwd:160:34: note: 'std::ofstream' typedef basic_ofstream<char> ofstream; ^ sortare.cpp:80:11: error: expected ';' before 'g' ofstream g("out.txt"); ^ sortare.cpp:83:2: error: 'f' was not declared in this scope f >> n; ^ sortare.cpp:85:24: error: 'citire_dinamic' was not declared in this scope citire_dinamic(f, p, n); ^ sortare.cpp:87:18: error: 'g' was not declared in this scope afisare_dinamic(g, p, n, ' '); ^ sortare.cpp:87:30: error: 'afisare_dinamic' was not declared in this scope afisare_dinamic(g, p, n, ' '); ^ sortare.cpp: In instantiation of 'int cautbin_poz_min_sir_descrescator(TIP, TIP*, int, int, bool) [with TIP = int]': sortare.cpp:49:74: required from 'void insertionsort(TIP*, int) [with TIP = int]' sortare.cpp:86:20: required from here sortare.cpp:22:51: error: 'log2' was not declared in this scope int lg = pow(2, (int)log2(poz_fin - poz_start + 1)); ^ sortare.cpp:22:52: error: 'pow' was not declared in this scope int lg = pow(2, (int)log2(poz_fin - poz_start + 1)); ^ sortare.cpp:24:8: warning: statement has no effect [-Wunused-value] for (i; lg; lg >>= 1) ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Sortare face parte din prima categorie. 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ă.