Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 9th, 2006, 3:41 AM   #11
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
Quote:
Originally Posted by MasterYoda
Dark,

myTotal=myTotal+sales[0][myCol]

if i change the value 0 to i , i won't get the value as below

The total sale of Dealer 1 is 170
The total sale of Dealer 2 is 57
The total sale of Dealer 3 is 203
The total sale of Dealer 4 is 23
The total sale of Dealer 5 is 118

what make me feel headache is to get that 170,57,203,23,118
Just applying what The Dark says gives you:
#include <stdio.h>

int main(void)
{
	int sales[5][4] =
	{
	  {20, 30, 40, 80},
	  {6, 23, 0, 28},
	  {11, 83, 48, 61},
	  {12, 1, 4, 6},
	  {19, 21, 28, 50}
	};

	int myCol, i, myTotal = 0;

	for(i = 0; i <= 4; i++)
	{
		myTotal = 0;

		for (myCol = 0; myCol <= 3; myCol++)
			myTotal = myTotal + sales[i][myCol];

		printf("The total sale of Dealer %d is %d\n", i+1, myTotal);
	}

	return 0;
}
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
-- Socrates
nnxion is offline   Reply With Quote
Old May 9th, 2006, 3:55 AM   #12
MasterYoda
Newbie
 
Join Date: May 2006
Posts: 4
Rep Power: 0 MasterYoda is on a distinguished road
Thanks everyone

Thanks to nnxion,morzel,sane,the dark for sharing your knowledge

god bless u
MasterYoda is offline   Reply With Quote
Old May 9th, 2006, 8:47 AM   #13
ReggaetonKing
Sexy Programmer
 
ReggaetonKing's Avatar
 
Join Date: Nov 2005
Location: New Jersey
Posts: 891
Rep Power: 4 ReggaetonKing is on a distinguished road
Send a message via AIM to ReggaetonKing
Quote:
Originally Posted by Sane
By the way... out of shear curiosity. What is a 26 year old doing learning C? Again... just because this is the kind of thing to perk up my ears. <_<
@Sane:
What does it matter if someone wants to learn C even if they are 26 or w/e age? I would like to learn C some day. Will you go to me and say, "why are you learning C..."? If someone picks that language or just wants to experience I dont think you should have a say in their choice of a programming language.
__________________
I would love to change the world, but they won't give me the source code!
ReggaetonKing is offline   Reply With Quote
Old May 9th, 2006, 9:15 AM   #14
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,473
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
Age has nothing to do with programming... only the ability to read, write, type and think logically with an analytical mindset. I've seen this in 10 year olds. I also had a 60+ year old in a few of my higher level courses back in college, which included some projects in C.
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old May 9th, 2006, 9:53 AM   #15
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
C wasn't even around when I was 26. Do I need to unlearn what little of it I know, because I learned it late?
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old May 9th, 2006, 11:08 AM   #16
ReggaetonKing
Sexy Programmer
 
ReggaetonKing's Avatar
 
Join Date: Nov 2005
Location: New Jersey
Posts: 891
Rep Power: 4 ReggaetonKing is on a distinguished road
Send a message via AIM to ReggaetonKing
Well my point, I don't like people insulting others because of their age and wanting to learn a language that's over 3 decades old.

@DaWei: You are really old! lol
__________________
I would love to change the world, but they won't give me the source code!
ReggaetonKing is offline   Reply With Quote
Old May 9th, 2006, 1:14 PM   #17
Mjordan2nd
The Supreme Ruler
 
Join Date: May 2004
Location: Houston
Posts: 1,476
Rep Power: 6 Mjordan2nd is on a distinguished road
Quote:
Originally Posted by DaWei
C wasn't even around when I was 26. Do I need to unlearn what little of it I know, because I learned it late?
Definitely! Unlearn it now, NOW! :p
__________________
&quot;Every gun that is made, every warship launched, every rocket signifies, in the final sense, a theft from those who hunger and are not fed, from those who are cold and are not clothed. The world in arms is not spending money alone. It is spending the sweat of its laborers, the genius of its scientists, the hopes of its children.&quot; - Dwight D. Eisenhower
Mjordan2nd is offline   Reply With Quote
Old May 9th, 2006, 1:54 PM   #18
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Quote:
@DaWei: You are really old! lol
Indeed. I find it beats the alternative. It also beats being young and ignorant. I'll forego, for the present, the lebenty-twelve other appellations that noobs on the forum often bring to mind.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old May 9th, 2006, 4:37 PM   #19
Sane
Programming Guru
 
Sane's Avatar
 
Join Date: Apr 2005
Location: Waterloo, Ontario
Posts: 2,086
Rep Power: 6 Sane will become famous soon enough
Send a message via MSN to Sane
Quote:
Originally Posted by reggaeton_king
@Sane:
What does it matter if someone wants to learn C even if they are 26 or w/e age? I would like to learn C some day. Will you go to me and say, "why are you learning C..."? If someone picks that language or just wants to experience I dont think you should have a say in their choice of a programming language.


Wow... did you ever take what I said in the complete wrong direction...

By the way, Morzel and The Dark. You both said something that I had already mentioned in my post. I gave him all he needed to know to finish the program, so I wouldn't consider my intentions insufficient. Especially since he is doing this to learn for what seems to be a paying job... I'd be careful how much you tell him. Never want to dig yourself in to a hole. I doubt any good programmers out there would have appreciated hand holding when they first started. I know I didn't... I had no Internet and knew zero programmers...
Sane is offline   Reply With Quote
Old May 9th, 2006, 5:58 PM   #20
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
Quote:
Originally Posted by Sane
Especially since he is doing this to learn for what seems to be a paying job... I'd be careful how much you tell him. Never want to dig yourself in to a hole.
I have always found it good to see once how some things are done, they can later be easily applied by me as well. Of course some things are done on your own, a bit of research never hurt anyone.
Quote:
Originally Posted by Sane
I doubt any good programmers out there would have appreciated hand holding when they first started. I know I didn't... I had no Internet and knew zero programmers...
When I was young I liked it when my mom holded my hands when I was walking on a ledge or so. When I got older I liked to be more free and try things on my own. If I'd ask her to hold my hand now, she'd probably think I've lost my mind.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
-- Socrates
nnxion is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:28 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC