#1700
produsMatriceRara
C++
Scrieţi în limbajul C++
definiţia completă a subprogramului inmultire
cu următorul antet:
void inmultire(matrice_rara a, matrice_rara b, matrice_rara &c)
ce calculează în c
produsul matricelor rare a
şi b
.
Problema | produsMatriceRara | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #51513715 | Utilizator | |
Fișier | produsmatricerara.cpp | Dimensiune | 2.32 KB |
Data încărcării | 02 Iulie 2024, 16:34 | Scor / rezultat | Eroare de compilare |
produsmatricerara.cpp:31:8: error: redefinition of 'struct triplet' struct triplet ^ produsmatricerara.cpp:5:8: error: previous definition of 'struct triplet' struct triplet { ^ produsmatricerara.cpp:36:8: error: redefinition of 'struct matrice_rara' struct matrice_rara ^ produsmatricerara.cpp:9:8: error: previous definition of 'struct matrice_rara' struct matrice_rara { ^ produsmatricerara.cpp:40:4: error: invalid type in declaration before ',' token } a,b,c; ^ produsmatricerara.cpp: In function 'void inmultire(matrice_rara, matrice_rara, matrice_rara&)': produsmatricerara.cpp:49:80: warning: suggest parentheses around '&&' within '||' [-Wparentheses] if(b.t[i].coloana>b.t[j].coloana || b.t[i].coloana==b.t[j].coloana && b.t[i].linie>b.t[j].linie) ^ produsmatricerara.cpp: In function 'void afisare(matrice_rara)': produsmatricerara.cpp:88:9: error: reference to 'cout' is ambiguous cout<<c.t[i].linie<<" "<<c.t[i].coloana<<" "<<c.t[i].valoare<<'\n'; ^ produsmatricerara.cpp:29:10: note: candidates are: std::ofstream cout ofstream cout("matricerara.out"); ^ In file included from produsmatricerara.cpp:1:0: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ produsmatricerara.cpp: In function 'int main()': produsmatricerara.cpp:93:5: error: reference to 'cin' is ambiguous cin>>a.nr_linii>>a.nr_coloane>>a.nr_triplete; ^ produsmatricerara.cpp:28:10: note: candidates are: std::ifstream cin ifstream cin("matricerara"); ^ In file included from produsmatricerara.cpp:1:0: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ produsmatricerara.cpp:93:12: error: request for member 'nr_linii' in 'a', which is of non-class type 'int' cin>>a.nr_linii>>a.nr_coloane>>a.nr_triplete; ^ produsmatricerara.cpp:93:24: error: request for member 'nr_coloane' in 'a', which is of non-class type 'int' cin>>a.nr_linii>>a.nr_coloane>>a.nr_triplete; ^ produsmatricerara.cpp:93:38: error: request for member 'nr_triplete' in 'a', which is of non-class type 'int' cin>>a.nr_linii>>a.nr_coloane>>a.nr_triplete; ^ produsmatricerara.cpp:94:18: error: request for member 'nr_triplete' in 'a', which is of non-class type 'int' for(i=0; i<a.nr_triplete; i++) ^ produsmatricerara.cpp:95:9: error: reference to 'cin' is ambiguous cin>>a.t[i].linie>>a.t[i].coloana>>a.t[i].valoare; ^ produsmatricerara.cpp:28:10: note: candidates are: std::ifstream cin ifstream cin("matricerara"); ^ In file included from produsmatricerara.cpp:1:0: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ produsmatricerara.cpp:95:16: error: request for member 't' in 'a', which is of non-class type 'int' cin>>a.t[i].linie>>a.t[i].coloana>>a.t[i].valoare; ^ produsmatricerara.cpp:95:30: error: request for member 't' in 'a', which is of non-class type 'int' cin>>a.t[i].linie>>a.t[i].coloana>>a.t[i].valoare; ^ produsmatricerara.cpp:95:46: error: request for member 't' in 'a', which is of non-class type 'int' cin>>a.t[i].linie>>a.t[i].coloana>>a.t[i].valoare; ^ produsmatricerara.cpp:96:5: error: reference to 'cin' is ambiguous cin>>b.nr_linii>>b.nr_coloane>>b.nr_triplete; ^ produsmatricerara.cpp:28:10: note: candidates are: std::ifstream cin ifstream cin("matricerara"); ^ In file included from produsmatricerara.cpp:1:0: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ produsmatricerara.cpp:96:12: error: request for member 'nr_linii' in 'b', which is of non-class type 'int' cin>>b.nr_linii>>b.nr_coloane>>b.nr_triplete; ^ produsmatricerara.cpp:96:24: error: request for member 'nr_coloane' in 'b', which is of non-class type 'int' cin>>b.nr_linii>>b.nr_coloane>>b.nr_triplete; ^ produsmatricerara.cpp:96:38: error: request for member 'nr_triplete' in 'b', which is of non-class type 'int' cin>>b.nr_linii>>b.nr_coloane>>b.nr_triplete; ^ produsmatricerara.cpp:97:18: error: request for member 'nr_triplete' in 'b', which is of non-class type 'int' for(i=0; i<b.nr_triplete; i++) ^ produsmatricerara.cpp:98:9: error: reference to 'cin' is ambiguous cin>>b.t[i].linie>>b.t[i].coloana>>b.t[i].valoare; ^ produsmatricerara.cpp:28:10: note: candidates are: std::ifstream cin ifstream cin("matricerara"); ^ In file included from produsmatricerara.cpp:1:0: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ produsmatricerara.cpp:98:16: error: request for member 't' in 'b', which is of non-class type 'int' cin>>b.t[i].linie>>b.t[i].coloana>>b.t[i].valoare; ^ produsmatricerara.cpp:98:30: error: request for member 't' in 'b', which is of non-class type 'int' cin>>b.t[i].linie>>b.t[i].coloana>>b.t[i].valoare; ^ produsmatricerara.cpp:98:46: error: request for member 't' in 'b', which is of non-class type 'int' cin>>b.t[i].linie>>b.t[i].coloana>>b.t[i].valoare; ^ produsmatricerara.cpp:99:20: error: could not convert 'a' from 'int' to 'matrice_rara' inmultire(a,b,c); ^ produsmatricerara.cpp:100:14: error: could not convert 'c' from 'int' to 'matrice_rara' afisare(c); ^ produsmatricerara.cpp: In function 'int main()': produsmatricerara.cpp:106:5: error: redefinition of 'int main()' int main() { ^ produsmatricerara.cpp:91:5: error: 'int main()' previously defined here int main() ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema produsMatriceRara 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ă.