C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 16th, 2013, 06:30 AM
SwiftXShadow SwiftXShadow is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 4 SwiftXShadow User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 32 m 40 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old January 16th, 2013, 06:54 AM
salem's Avatar
salem salem is offline
Contributed User
Click here for more information
 
Join Date: Jun 2005
Posts: 3,840 salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)  Folding Points: 153 Folding Title: Novice Folder
Time spent in forums: 2 Months 3 Weeks 2 Days 19 h 25 m 12 sec
Reputation Power: 1774
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
Winters agrees: I'm considering printing this post, framing it and sticking it onto the outside of my office door.
No you won't get credit for it.
__________________
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper

Reply With Quote
  #3  
Old January 16th, 2013, 06:58 AM
SwiftXShadow SwiftXShadow is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 4 SwiftXShadow User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 32 m 40 sec
Reputation Power: 0
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()%(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;
}

Reply With Quote
  #4  
Old January 16th, 2013, 07:55 AM
SwiftXShadow SwiftXShadow is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 4 SwiftXShadow User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 32 m 40 sec
Reputation Power: 0
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..

Reply With Quote
  #5  
Old January 16th, 2013, 01:46 PM
salem's Avatar
salem salem is offline
Contributed User
Click here for more information
 
Join Date: Jun 2005
Posts: 3,840 salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)  Folding Points: 153 Folding Title: Novice Folder
Time spent in forums: 2 Months 3 Weeks 2 Days 19 h 25 m 12 sec
Reputation Power: 1774
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 ...

Reply With Quote
  #6  
Old January 16th, 2013, 01:51 PM
SwiftXShadow SwiftXShadow is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 4 SwiftXShadow User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 32 m 40 sec
Reputation Power: 0
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()%(MAX-MIN)+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;
}

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > I need very fast help, like within the hour, please!

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap