# Need helping getting this matrix3x3 \* matrix3x1 having 1 error

**URL:** <https://forum.kirupa.com/t/need-helping-getting-this-matrix3x3-matrix3x1-having-1-error/282390>\
**Category:** Uncategorized\
**Created:** [February 21, 2009, 8:12am UTC](https://forum.kirupa.com/t/need-helping-getting-this-matrix3x3-matrix3x1-having-1-error/282390 "2009-02-21T08:12:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![frostbite907](https://avatars.discourse-cdn.com/v4/letter/f/73ab20/32.png) [@frostbite907](https://forum.kirupa.com/u/frostbite907)\
**Post date:** [February 21, 2009, 8:12am UTC](https://forum.kirupa.com/t/need-helping-getting-this-matrix3x3-matrix3x1-having-1-error/282390/1 "2009-02-21T08:12:19Z")

</div>

This is in C++ Code

Hello im currently trying to finish one of my programs for class im having a small problem iv been trying to code this for 10+ hours now but im currently trying to get my 3x3 \* 3x1 to work but i cant seem to get it to work. Im getting some of my code out of the book but here it is.

This is in my MathLib.h file i need to be able to use these functions to muliply other matrices.  
[SIZE=2][COLOR=#0000ff]#include[/COLOR][/SIZE][SIZE=2][COLOR=#a31515]\<cmath\>[/COLOR][/SIZE]  
[SIZE=2][COLOR=#0000ff]#include[/COLOR][/SIZE][SIZE=2][COLOR=#a31515]\<iomanip\>[/COLOR][/SIZE]  
[SIZE=2][COLOR=#0000ff]#include[/COLOR][/SIZE][SIZE=2][COLOR=#a31515]\<iostream\>[/COLOR][/SIZE]  
[SIZE=2][COLOR=#0000ff]#include[/COLOR][/SIZE][SIZE=2][COLOR=#a31515]\<stdlib.h\>[/COLOR][/SIZE]  
[SIZE=2][COLOR=#0000ff]using[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]namespace[/COLOR][/SIZE][SIZE=2] std;[/SIZE]  
[SIZE=2][COLOR=#008000]//typedef struct[/COLOR][/SIZE]  
[SIZE=2][COLOR=#008000]//{[/COLOR][/SIZE]  
[SIZE=2][COLOR=#008000]//float index[3][3];[/COLOR][/SIZE]  
[SIZE=2][COLOR=#008000]//} Matrix3x3;[/COLOR][/SIZE]  
[SIZE=2][COLOR=#0000ff]struct[/COLOR][/SIZE][SIZE=2] Matrix3X3{[/SIZE]  
[SIZE=2][COLOR=#0000ff]private[/COLOR][/SIZE][SIZE=2]:[/SIZE]  
[SIZE=2][COLOR=#0000ff]public[/COLOR][/SIZE][SIZE=2]:[/SIZE]  
[SIZE=2][COLOR=#0000ff]float[/COLOR][/SIZE][SIZE=2] index[3][3];[/SIZE]  
[SIZE=2]Matrix3X3 muliply3X3Matrices(Matrix3X3 a, Matrix3X3 b)[/SIZE]  
[SIZE=2]{[/SIZE]  
[SIZE=2]Matrix3X3 temp;[/SIZE]  
[SIZE=2][COLOR=#0000ff]for[/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][SIZE=2] i = 0; i\<3; i++)[/SIZE]  
[SIZE=2]{[/SIZE]  
[SIZE=2][COLOR=#0000ff]for[/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][SIZE=2] j = 0; j\<3; j++)[/SIZE]  
[SIZE=2]{[/SIZE]  
[SIZE=2][COLOR=#0000ff]for[/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][SIZE=2] k = 0; k\<3; k++)[/SIZE]  
[SIZE=2]{[/SIZE]  
[SIZE=2]temp.index\*[j] += (a.index\*[k] \* b.index[k][j]);[/SIZE]  
[SIZE=2]}[/SIZE]  
[SIZE=2]}[/SIZE]  
[SIZE=2]}[/SIZE]  
[SIZE=2][COLOR=#0000ff]return[/COLOR][/SIZE][SIZE=2] temp;[/SIZE]  
[SIZE=2]}[/SIZE]  
[SIZE=2]};[/SIZE]  
[SIZE=2][COLOR=#0000ff]struct[/COLOR][/SIZE][SIZE=2] Matrix3X1{[/SIZE]  
[SIZE=2][COLOR=#0000ff]private[/COLOR][/SIZE][SIZE=2]:[/SIZE]  
[SIZE=2][COLOR=#0000ff]public[/COLOR][/SIZE][SIZE=2]:[/SIZE]  
[SIZE=2][COLOR=#0000ff]float[/COLOR][/SIZE][SIZE=2] index[3][3];[/SIZE]  
[SIZE=2][COLOR=#0000ff]float[/COLOR][/SIZE][SIZE=2] index1[3][1];[/SIZE]  
[SIZE=2]Matrix3X1 muliply3X3Matrices(Matrix3X3 a, Matrix3X1 b)[/SIZE]  
[SIZE=2]{[/SIZE]  
[SIZE=2]Matrix3X1 temp;[/SIZE]  
[SIZE=2]temp.index1[0][0] = 0.0f;[/SIZE]  
[SIZE=2]temp.index1[1][0] = 0.0f;[/SIZE]  
[SIZE=2]temp.index1[2][0] = 0.0f;[/SIZE]  
[SIZE=2][COLOR=#0000ff]for[/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][SIZE=2] i = 0; i\<3; i++)[/SIZE]  
[SIZE=2]{[/SIZE]  
[SIZE=2][COLOR=#0000ff]for[/COLOR][/SIZE][SIZE=2]([/SIZE][SIZE=2][COLOR=#0000ff]int[/COLOR][/SIZE][SIZE=2] j = 0; j\<3; j++)[/SIZE]  
[SIZE=2]{[/SIZE]  
[SIZE=2]temp.index1\* += (a.index\*[j] \* b.index1[j]); //THIS IS THE PROBLEM AREA[/SIZE]  
[SIZE=2]}[/SIZE]  
[SIZE=2]}[/SIZE]  
[SIZE=2][COLOR=#0000ff]return[/COLOR][/SIZE][SIZE=2] temp;[/SIZE]  
[SIZE=2]}[/SIZE]  
[SIZE=2]};[/SIZE]  
[SIZE=2]the error im getting is marked with caps its right above this. The error is[/SIZE]

[SIZE=2][SIZE=1]1\>------ Build started: Project: Lab6.2, Configuration: Debug Win32 ------[/SIZE]  
[SIZE=2]1\>Compiling…[/SIZE]  
[SIZE=2]1\>main.cpp[/SIZE]  
[SIZE=2]1\>c:\users\user\desktop\class\project\data.h(51) : error C2297: ‘\*’ : illegal, right operand has type ‘float [1]’[/SIZE]  
[SIZE=2]1\>Build log was saved at “file://c:\Users\c:\users\user\desktop\class\project\Debug\BuildLog.htm”[/SIZE]  
[SIZE=2]1\>Lab6.2 - 1 error(s), 0 warning(s)[/SIZE]  
[SIZE=2]========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========[/SIZE]

[SIZE=2][SIZE=3]il be on till 2 am West Cost time trying to solve this iv already been at it 4 hours at class and from 9 to 12 and thats only just today working on this. If you can help me and you do i thanky very much good sir.[/SIZE]  
[/SIZE][/SIZE]
