January 16th, 2013, 07:30 AM

I need very fast help, like within the hour, please!
I need to make a programm (probably childs play to most of u)
But i have no clue how to do it, so please help, i need it done really fast.
The prgoramm is:
Write a programm in C++ that finds a matrixs A[4][7], then the sums (by adding them togeter) of all the positive elements of the numbers in the matrix from the third column and all the columns to the right of it(one sum for each column). And the shows it on the screen.
If anyone could quicky make me the programm i would be very greatfull.
It is a part of my homework that i have to send in with in the hour AT max 2 hours and i have no clue how to do that part. Really need help
January 16th, 2013, 07:54 AM

Perhaps you need one of these.
Or maybe, you just need to plan ahead
> It is a part of my homework that i have to send in with in the hour AT max 2 hours and i have no clue how to do that part.
Perhaps you could consider a couple of things for us:
1. Why you deserve the benefit of a good grade with minimal effort?
2. Why you deserve a grade far above what you're capable of achieving yourself?
3. How you're going to convince your tutor that something you were given is really your own work (compared to the poor work you've handed in so far)?
> Really need help
Yes, a lot more than just a bit of code on a plate.
If you really want help, then
a) show up with at LEAST 24 hours to go.
b) show up with your latest effort, no matter how bad you think it is.
Then we can tell you what you're doing right/wrong and guide you to the answer (so that you actually LEARN something).
Comments on this post
January 16th, 2013, 07:58 AM

The only reason i found a forum to ask is because i am running out of time, i thought i could do all if it but i am stuck here. That is just a part of it, but i have no clue how to do that part.
Well i think i even got the matix down form this part, but i got no clue how to axess a column, so start multiplying them......
right now form this part this is what i manuaged to make, but.. i can only make it get some random diagonal? i got no idea how to get to a column and sum the numbers up there?
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#define RIDU 4
#define VEERGE 7
#define MAX 150
#define MIN 10
int main (void)
{
int maatriks [RIDU] [VEERGE];
int i,j;
srand(time(NULL));
for(i=0; i<RIDU; i++)
{
for(j=0; j<VEERGE; j++)
{
maatriks[i][j]=rand()%(MAXMIN)+MIN;
}
}
printf("Generated maatrx on:\n\n");
for(i=0; i<RIDU; i++)
{
for(j=0; j<VEERGE; j++)
{
printf("%4d", maatriks[i][j]);
}
printf("\n\n");
}
printf("third column?\n\n");
for(i=0; i<RIDU; i++)
{
for(j=0; j<VEERGE; j++)
{
if (i>=j) printf("%4d", maatriks[i][j]);
}
printf("\n");
}
return 0;
}
January 16th, 2013, 08:55 AM

by addind that to the end i manuaged to get the last column of my matrix on the screen... (no clue how to generate anything in the middle of the matrix like fourth column to the screen alone), but how on earth can i get the programm to sum up all the numbers from that column now?
printf("Last column\n");
for(i=0; i<RIDU; i++)
{
for(j=0; j<VEERGE; j++)
{
if (j>5) printf("%4d", maatriks[i][j]);
}
printf("\n");
}
Also u said about learning, with all due respect to anyone answers, i dun care about learning right now, i need to get it done to not fail the programming course, to me this is right now trying to despretly get it done by any means necessary..
January 16th, 2013, 02:46 PM

First of all, remember to use [code][/code] tags when posting code.
Otherwise, all indentation is lost.
Code:
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#define RIDU 4
#define VEERGE 7
#define MAX 150
#define MIN 10
int main(void)
{
int maatriks[RIDU][VEERGE];
int i, j;
srand(time(NULL));
for (i = 0; i < RIDU; i++)
{
for (j = 0; j < VEERGE; j++) {
maatriks[i][j] = rand() % (MAX  MIN) + MIN;
}
}
printf("Generated maatrx on:\n\n");
for (i = 0; i < RIDU; i++) {
for (j = 0; j < VEERGE; j++) {
printf("%4d", maatriks[i][j]);
}
printf("\n\n");
}
printf("third column?\n\n");
for (i = 0; i < RIDU; i++) {
for (j = 0; j < VEERGE; j++) {
if (i >= j)
printf("%4d", maatriks[i][j]);
}
printf("\n");
}
return 0;
}
Next, if you just want to isolate a column, try
Code:
for ( row = 0 ; row < MAX_ROWS ; row++ ) {
printf("%d\n", matrix[row][3] );
}
Note the use of a more meaningful variable name than i or j.
Likewise, if you want to process by columns, you would nest the loops
Code:
for ( col = 0....
for ( row = 0 ...
January 16th, 2013, 02:51 PM

Um soo far i have manauged to isolate all my needed columns already, but for hours i havent been able to feagure out how to make them sum up the numbers... and i still dont know
Code:
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#define RIDU 4
#define VEERGE 7
#define MAX 15
#define MIN 10
int main (void)
{
int maatriks [RIDU] [VEERGE];
int i,j;
int nTotal = 0;
srand(time(NULL));
for(i=0; i<RIDU; i++)
{
for(j=0; j<VEERGE; j++)
{
maatriks[i][j]=rand()%(MAXMIN)+MIN;
}
}
printf("Genereeritud matrix on:\n\n");
for(i=0; i<RIDU; i++)
{
for(j=0; j<VEERGE; j++)
{
printf("%4d", maatriks[i][j]);
}
printf("\n\n");
}
printf("========================================\n");
printf("Kolmandast tulbast paremale jäävad tulbad\n");
for(i=0; i<RIDU; i++)
{
for(j=0; j<VEERGE; j++)
{
if (j>2) printf("%4d", maatriks[i][j]);
}
printf("\n");
}
printf("========================================\n");
for(i=0; i<RIDU; i++)
{
nTotal += maatriks[i][2];
}
printf("neljas tulp ja selle arvude summad\n");
for(i=0; i<RIDU; i++)
{
for(j=0; j<VEERGE; j++)
{
if (j<1) printf("%4d", maatriks[i][3]);
}
printf("\n");
}
printf("\n");
printf("viies tulp ja selle arvude summad\n");
for(i=0; i<RIDU; i++)
{
for(j=0; j<VEERGE; j++)
{
if (j<1) printf("%4d", maatriks[i][4]);
}
printf("\n");
}
printf("\n");
printf("kuues tulp ja selle arvude summad\n");
for(i=0; i<RIDU; i++)
{
for(j=0; j<VEERGE; j++)
{
if (j<1) printf("%4d", maatriks[i][5]);
}
printf("\n");
}
printf("\n");
printf("seitsmes tulp ja selle arvude summad\n");
for(i=0; i<RIDU; i++)
{
for(j=0; j<VEERGE; j++)
{
if (j<1) printf("%4d", maatriks[i][6]);
}
printf("\n");
}
printf("\n");
printf("\n\n\n\n");
printf("\n");
printf ("%d", nTotal);
scanf ("%d");
return 0;
}