Computing.Net > Forums > Programming > qns on c programing?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

qns on c programing?

Reply to Message Icon

Name: shaun-
Date: June 30, 2003 at 22:19:25 Pacific
OS: winxp
CPU/Ram: 1024
Comment:

Write a function called TwoDimArr that take in a two dimensional integer array Twodim of 2 rows and 2 colums. The functions sums up the diagonal values and return this sum.

10 20
30 40
eg. the function will return 50(as 10 + 40=50)

someone pls help me!!



Sponsored Link
Ads by Google

Response Number 1
Name: borelli34
Date: June 30, 2003 at 22:25:22 Pacific
Reply:


This is why, when my son begins school, I will be monitoring his internet activity.

borelli34


0

Response Number 2
Name: SN
Date: June 30, 2003 at 23:09:59 Pacific
Reply:

This is why I'm never having kids.
-SN
P.S. Nice to see you back b - The VB posters especially have missed you!


0

Response Number 3
Name: micah
Date: June 30, 2003 at 23:16:59 Pacific
Reply:

#include "iostream.h"

IDENTIFICATION DIVISION.
#define author "not Micah"
print "this is my program, i did it myself give me a 100"

PROCEDURE DIVITION.
static char* void unsigned int main(void){
echo("this program sums up the diagonal values and returns the sum...i did not cheat. enter 'd' when done.");

my pVariable;
char* AllNums = new char[1234];
Input $pVariable

If pVariable "" Then
if(pVariable == 'b')
TwoDimArr(AllNums);
return 0;
}
AllNums = AllNums + pVariable
End If
}

COMPUTE SECTION.
Private Sub TwoDimArr(Numbers as GLFloat)
int result = ComputeDiag(Numbers);
Numbers++;

result += Numbers[5] ^ "d";

printf("Youre result is %s", Result);
End Sub
STOP RUN.

And there you go. Slap your name on that and I trust your teacher/professor will most likely give you and 'A' plus some sort of extra credit. Umm...First you might want to wait and see if anyone here in the forums can find any mistakes I have made...

-Micah


0

Response Number 4
Name: Don Arnett
Date: July 1, 2003 at 00:06:28 Pacific
Reply:

At one time I taught some programming classes at a local community college. I think I was teaching a PASCAL class and someone brought a program similar to the one above to me for some help.

The program was a mixture of numerous languages. Plus, even if the computer could have figured out what she was trying to do, it would have never come close to doing what it was supposed to do.



0

Response Number 5
Name: borelli34
Date: July 1, 2003 at 00:25:51 Pacific
Reply:

What do they call this language? C, Cobol and BASIC all mixed into one? Why didn't I think of that!

Micah, you are so bad....

borelli34


0

Related Posts

See More



Response Number 6
Name: micah
Date: July 1, 2003 at 00:38:36 Pacific
Reply:

yeah, and a lil PHP & Perl. I was going to put some PASCAL in there and maybe some ASM but I forgot:( Oh well, I think its pretty good as is.

-Micah


0

Response Number 7
Name: borelli34
Date: July 1, 2003 at 01:17:22 Pacific
Reply:

===============================================================
Ok, guys, lets let him off the hook a little.

shaun, The reason we have joked about this so much is that just about everyone that has posted here has learned (at bare minimum in part) what they know by working through it. We are not trying to discourage you. On the contrary, we want to encourage you not to give up. I myself have been programming since I was 12 years old in 1980. I am now 34 years old and know 7 programming languages (not counting all the variations) and I have never taken a single class for programming. I'm not bragging but I just want you to know that you can do this if you set your mind to it and you like doing it. If you are stuck an a specific concept we will be happy to help you any way we can but you will be hard pressed to find anyone who will do the work for you. In other words, if we can explain the concepts (and we may choose to use code to illistrate it) then we will. But please do not recite your assignment and ask us to do it for you. We are here to help. Doing the work for you would be hurting your efforts in the long run. I hope you can understand. Best of luck!

borelli34



0

Response Number 8
Name: SN
Date: July 1, 2003 at 05:49:29 Pacific
Reply:

Top notch micah.

Don-What did you tell the student?

Ditto on what borelli said (except I'm not 34, didn't learn it on my own, and certainly don't know 7 languages)

I originally came to this forum seeking help on my homework as well (which I never did get an answer on thanks for nothing guys:-) and these fellas are usually happy to help, but the secret is to ask specific questions, not just put in the assignment word for word. Post some code to show us what you've got, even if it's crap. If you don't, you're likely to be mocked. In your case, a little more than most:-)
-SN


0

Response Number 9
Name: micah
Date: July 1, 2003 at 08:47:20 Pacific
Reply:

Thanx man. Even if he turned that in I bet he'd get some credit.

Yes, and ditto on borelli...But I started when I was 13 and I'm now 18:) Except I really dont know PASCAL that great anymore since I haven't used it in years. So maybe I should say I know 6 Languages.

Unfortunately I havent been blessed with the opertunity to have programming homework yet:( Next fall tho...introductory java course. *sniff*

Well anyways, what SN said...If I see some sort of effort/attempt I'd be more than glad to help out. It's not like I have anything better to do with my time:)

-Micah


0

Response Number 10
Name: borelli34
Date: July 1, 2003 at 10:18:07 Pacific
Reply:

=================================================
Micah,

WOW! You're only 18! My friend...keep doing what you are doing. Judging from your posts you have a tremendous future waiting for you. You answer peoples questions with the best of them. If you keep it up, who knows? You might just be the next Peter Norton. I wouldn't insult you by comparing you to Bill Gates. As we all know, he stole his origin MS product from Steve Jobs who stole it from Xerox. You have more programming skill than that! Keep it up!

borelli34

PS: Yes, do go to school. Even whith all you know, whithout that piece of paper it is very hard to find work. I've only started REAL programming work in the past 5 years. Sob, programmers are so mis-understood!

And...while I'm here...does anyone have an answer to the thread I submitted that is just above this one? Thanks!



0

Response Number 11
Name: micah
Date: July 1, 2003 at 14:52:49 Pacific
Reply:

Thanks man, that's very encouraging. I hope someone will hire me once I get out of college. Haha, yeah, if I ever turned out to be the next bill gates I'd have to do us all a favor and shoot myself:) His ethics suck. Even with DOS he pretty much sold it to IBM before he even had it. Then he had to go buy it off some guy for what was it...$50,000?

Yeah, I'm goin' to college in a lil over a month...So what kind of programming do you do, what language? Heh, we are mis-understood expecially by people that know nothing about computers. Mostly my friends and the school system, if something happens...It just HAD to be me:) It's almost entertaining but it gets old after a while.

I think the best was when I was accused by some school facualty of hacking the school site and putting pr0n up:)

If the school system wouldnt have used a certain format for all the school's usernames and passwords in the server and if they didnt use frontpage those kinds of things wouldnt happen...

Oh well.

As to your question, I looked around but couldnt find anything for ya. Sorry.

-Micah


0

Response Number 12
Name: Infinite Recursion
Date: July 2, 2003 at 11:27:09 Pacific
Reply:

Since we are all getting to know each other here... I am a software engineer. I double majored in Computer Science and Software Engineering, with a minor in Mathematics. My emphasis is in Artificial Intelligence. I graduated with a Bachelor of Science degree last May... and yes, I can confirm that without the paper (degree) or a certification, you will not find a job when you start looking for one in the programming field. I just started these forums a few weeks ago, so bare with me as my available time is consumed by my employer... I will post more in time. ;)

Infinite Recursion


0

Response Number 13
Name: borelli34
Date: July 2, 2003 at 22:20:16 Pacific
Reply:

============================================================
Micah,

To answer question/comment 1: I program in C/C++/Visual C++, Pascal/Delphi, BASIC/Visual Basic, Assembly, Cobol (it's been a while on that one), HTML/VBA, LISP/Prolog and a few other less familiar and limited DB languages.

Second, I too was accused of similar deeds in high school. My problem was that they where true.

Third, I appreciate you checking on the component/class developement for me. Judging by the number of responses (lack of responses) there really isn't much out their. Thanks anyways.

borelli34



0

Response Number 14
Name: swarooptkv
Date: July 4, 2003 at 23:34:53 Pacific
Reply:

i take it for granted that u r talking about 2dim arrays which have same number of rows and columns.i have generalized it.
try the following program

int twodimarr(int **a,int r)
{
int i,sum=0;
for(i=0;ir;i++)
sum+=a[i][i];
return(sum);
}
main()
{
int a[50][50];
int row,col;
printf("Enter the no. of rows and columns in the matrix:");
scanf("%d %d",row,col);
if(row==col)
printf("%d",twodimarr(a,row);
}


0

Sponsored Link
Ads by Google
Reply to Message Icon

OLE questions component/class dev. kits



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: qns on c programing?

stacktrace in C program on Solaris8 www.computing.net/answers/programming/stacktrace-in-c-program-on-solaris8/15177.html

C program developed on visual C++, Versi www.computing.net/answers/programming/c-program-developed-on-visual-c-versi/1005.html

C Program Formula www.computing.net/answers/programming/c-program-formula/9392.html