Zum Inhalt springen

CaThill

Mitglieder
  • Gesamte Inhalte

    2
  • Benutzer seit

  • Letzter Besuch

  1. Danke für den Tipp, hab schon selber was entdeckt aber nicht das was du vorgeschlagen hast. Danke werde mal versuchen was damit anzustellen.
  2. Hallo Leute! Ich habe ein riesiges Problem!Hab einen Code geschrieben der mir die Matrizen zusammen zählen soll. Tut er natürlich nicht, anscheinend bin ich ned gut genug bei der Sache und habe auch keine Lust mehr drauf. Könnt ihr mir helfen? Das ist mein Code: //Addieren zweier Matrizen #include <iostream> #include <stdlib.h> using namespace std; const int dim=1; typedef float matrixtyp [dim][dim]; void liesMatrix (matrixtyp ,matrixtyp, int ); void addmatrix (const matrixtyp , const matrixtyp, matrixtyp , int ); void schreibMatrix (const matrixtyp, int); int main () { matrixtyp A; matrixtyp B; matrixtyp C; liesMatrix ( A,B, dim); addmatrix ( A, B, C, dim); schreibMatrix ( A, dim); system ("pause"); return 0; } //Einlesen zweier Matrizen void liesMatrix (matrixtyp A,matrixtyp B, int dim) { for (int i=0; i<dim; i++) { cout<<"Zeile"<<i+1<<": "; for (int j=0; j<dim; j++) cin>>A[i][j]; } for (int k=0; k<dim; k++) { cout<<"Zeile"<<k+1<<": "; for (int d=0; d<dim; d++) cin>>B[k][d]; } } //Addieren zweier Matrizen void addmatrix (const matrixtyp A, const matrixtyp B, matrixtyp C, int dim) { float summe; for (int i=0; i<dim; i++) for (int j=0; j<dim;j++) { summe=0; for ( int k=0; k<dim; k++) //Matrizenaddition summe += A[i][k]+B[k][j]; C[i][j]=summe; } } //Ausgeben einer Matrix void schreibMatrix (const matrixtyp C, int dim) { for (int i=0; i<dim; i++) { for (int j=0; j<dim; j++) cout<<C [i][j]; cout<<endl; } } Ich danke euch für die Ausbesserungen und Vorschläge und natürlich für jeden einzelnen Tipp. THX an alle Beteiligten.

Fachinformatiker.de, 2024 by SE Internet Services

fidelogo_small.png

Schicke uns eine Nachricht!

Fachinformatiker.de ist die größte IT-Community
rund um Ausbildung, Job, Weiterbildung für IT-Fachkräfte.

Fachinformatiker.de App

Download on the App Store
Get it on Google Play

Kontakt

Hier werben?
Oder sende eine E-Mail an

Social media u. feeds

Jobboard für Fachinformatiker und IT-Fachkräfte

×
×
  • Neu erstellen...