I'm doing my CP homework and I'm stuck at this exercise: Read from the keyboard the elements of a 3x3 float matrix. Rearrange the columns so that the sum of each column's elements is smaller than the sum of the elements of the next column to the right.
What have I done wrong?
December 11, 2016 - 02:35
December 11, 2016 - 02:37
December 11, 2016 - 02:38
I'll copy paste the code if that helps: #include using namespace std;
float sumac(float x[3][3], int c); void arrange(float x[3][3], int c1, int c2);
void main() { int i, j; float x[3][3]; for (i = 0; i < 3; i++) for (j = 0; j < 3; j++) { cout
December 11, 2016 - 02:43
>CP
Tip submitted thank you
December 11, 2016 - 03:10
December 11, 2016 - 03:12
CP= Computer Programming are you fucking retarded?
December 11, 2016 - 03:13
December 11, 2016 - 03:14
Yeah sure, I'm sure you pedos don't have codewords or anything.
fucking piece of shit
December 11, 2016 - 03:15
Right, right ;) No one is going to help you with CP
December 11, 2016 - 03:16
If you can't figure this out then you are the pseud
December 11, 2016 - 03:22
December 11, 2016 - 04:16
>report that CP spam, cunts
December 11, 2016 - 04:22
December 11, 2016 - 04:55
When you compile and run the code, what output do you get?
December 11, 2016 - 07:15
>prototyping functions in the same file as their declarations
kys
December 11, 2016 - 07:43
>temp = x[r1][j] (inside arrange) >assigning float value to an int variable
kys
December 11, 2016 - 07:48
You need to read Structure and Interpretation of CP.
December 11, 2016 - 07:49
>not returning anything from arrange
kys
December 11, 2016 - 07:50
i'm pretty sure this is actually the problem with your code
you're expecting the array x to be different after passing it into the arrange function but that's not how c++ works
you need to also return the modified array and pass it into a variable
December 11, 2016 - 07:52
put matrix into a vector sort vector rebuiild matrix
I think that could work if i understood the problem
December 11, 2016 - 07:53
>CP homework Nobody will help you with your pedo homework
>copy pastes code without using
[ c o d e ] your code here[ / c o d e ]
You are fucking filth! Read the sticky
December 11, 2016 - 07:55
You sound like that guy who thought it meant clown porn
December 11, 2016 - 08:02
December 11, 2016 - 08:08
#include using namespace std;
// #define N 3 // don't use magic numbers // check the sumac, i guess the problem is there. Didn't tested
float sumac(float[3][], int); void arrange(float[3][], int, int);
int main(int argc, char* argv[]) { int i, j; float x[3][3]; for (i = 0; i < 3; i++) for (j = 0; j < 3; j++) cin >> x[i][j];
for (j = 0; j < 3; j++) for (i = 0; i < 3; i++) { if (sumac(x, i) > sumac(x, i + 1)) arrange(x, i, i + 1); } for (i = 0; i < 3; i++) { for (j = 0; j < 3; j++) cout
December 11, 2016 - 08:09
December 11, 2016 - 08:11
>thinking CP means computer programming >being this new Lurk moare m7
December 11, 2016 - 08:16
sort each row from smallest to biggest number and you are done, fag
December 11, 2016 - 08:21
how did you do that, how did you post code that was not an image?
December 11, 2016 - 08:30
December 11, 2016 - 08:37
>inb4 OP runs a java virus given by fellow posters on this threab
December 11, 2016 - 08:38
December 11, 2016 - 08:39