I'm doing my CP homework and I'm stuck at this exercise: Read from the keyboard the elements of a 3x3 float matrix...

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?

Other urls found in this thread:

pastebin.com/HgBb7aDk
pastebin.com/TeygssWf
twitter.com/SFWRedditImages

>CP Homework

Kek

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

>CP

Tip submitted thank you

use pastebin dumbass

CP= Computer Programming are you fucking retarded?

Oh
pastebin.com/HgBb7aDk

Yeah sure, I'm sure you pedos don't have codewords or anything.

fucking piece of shit

Right, right ;)
No one is going to help you with CP

If you can't figure this out then you are the pseud

>CP homework

>report that CP spam, cunts

>CP

When you compile and run the code, what output do you get?

>prototyping functions in the same file as their declarations

kys

>temp = x[r1][j] (inside arrange)
>assigning float value to an int variable

kys

You need to read Structure and Interpretation of CP.

>not returning anything from arrange

kys

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

put matrix into a vector
sort vector
rebuiild matrix

I think that could work if i understood the problem

>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

You sound like that guy who thought it meant clown porn

pastebin.com/TeygssWf

#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

OP is a faggot

>thinking CP means computer programming
>being this new
Lurk moare m7

sort each row from smallest to biggest number and you are done, fag

how did you do that, how did you post code that was not an image?

...

>inb4 OP runs a java virus given by fellow posters on this threab

kek