Code problem with an array displaying list

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Mar 2005
Posts: 30
Reputation: augie0216 is an unknown quantity at this point 
Solved Threads: 0
augie0216's Avatar
augie0216 augie0216 is offline Offline
Light Poster

Code problem with an array displaying list

 
0
  #1
Mar 2nd, 2006
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());
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 9
Reputation: ludesign is an unknown quantity at this point 
Solved Threads: 0
ludesign's Avatar
ludesign ludesign is offline Offline
Newbie Poster

Re: Code problem with an array displaying list

 
0
  #2
Mar 2nd, 2006
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.
Винаги Ñ?е цели в луната, така и да пропуÑ?неш, пак ще Ñ?и Ñ?ред звездите!
by ludesign
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 30
Reputation: augie0216 is an unknown quantity at this point 
Solved Threads: 0
augie0216's Avatar
augie0216 augie0216 is offline Offline
Light Poster

Re: Code problem with an array displaying list

 
0
  #3
Mar 3rd, 2006
Thanks! The problem was code in the main was incorrect
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 9
Reputation: ludesign is an unknown quantity at this point 
Solved Threads: 0
ludesign's Avatar
ludesign ludesign is offline Offline
Newbie Poster

Re: Code problem with an array displaying list

 
0
  #4
Mar 3rd, 2006
Винаги Ñ?е цели в луната, така и да пропуÑ?неш, пак ще Ñ?и Ñ?ред звездите!
by ludesign
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C# Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC