943,846 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 3558
  • C# RSS
Mar 2nd, 2006
0

Code problem with an array displaying list

Expand Post »
After entering 8 names,phone numbers,and birthdays. A list appears at the bottom of the console which is suppose to display name,phone number, and birthday. Well with this code the name shows up so does the phone number,but the birthday doesn't show . Can someone help.

Thanks

for(x = 0; x < friend.Length; ++x)
Console.WriteLine
("Name is {0}, phone is {1}, and bday is {2}",
x +1, friend[x].GetName(), friend[x].GetPhone(),
friend[x].GetBday());
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
augie0216 is offline Offline
30 posts
since Mar 2005
Mar 2nd, 2006
0

Re: Code problem with an array displaying list

hi,

i'm new to C# but i know that arrays starts from 0 ( zero ) not from 1 ..
so remove x+1 from your WriteLine function.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ludesign is offline Offline
9 posts
since Feb 2006
Mar 3rd, 2006
0

Re: Code problem with an array displaying list

Thanks! The problem was code in the main was incorrect
Reputation Points: 10
Solved Threads: 0
Light Poster
augie0216 is offline Offline
30 posts
since Mar 2005
Mar 3rd, 2006
0

Re: Code problem with an array displaying list

Reputation Points: 10
Solved Threads: 0
Newbie Poster
ludesign is offline Offline
9 posts
since Feb 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: C# VS 2005 - Crystal reports question
Next Thread in C# Forum Timeline: Nesting A Table





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC