-
January 16th, 2013, 08:04 AM
#1
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
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()%(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;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|