displaying two dimensional array in columns help

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

Join Date: Apr 2007
Posts: 9
Reputation: sInFuL69er is an unknown quantity at this point 
Solved Threads: 0
sInFuL69er sInFuL69er is offline Offline
Newbie Poster

displaying two dimensional array in columns help

 
0
  #1
Apr 24th, 2007
  1. Hi iam having trouble with displaying my two dimensional array in columns
  2. eg.
  3. |Pie |Peach |Socks
  4. |$3.4 |$5 |$9
  5.  
  6. |Apple |Carrot etc...
  7. |$6.8 |$2
  8.  
  9. <span class="ad_notxt"><code class="inlinecode">
  10. //for(col = 0; col < COLSIZE; col++)
  11. for(row = 0; row < ROWSIZE; row++)
  12. {
  13. for(col = 0; col < COLSIZE; col++)
  14. //for(row = 0; row < ROWSIZE; row++)
  15. {
  16. ......
  17. </code></span>
  18. this loops through the array but i cant seem to get it to display the items in the array like how ppl teach other ppl how it looks like.
  19.  
  20. i've tried
  21. <span class="ad_notxt"><code class="inlinecode">
  22. cout.width(0);
  23. cout <<left<< "|" ;
  24. cout <<item[row][col].Name << endl;
  25.  
  26. cout.width(0);
  27. cout <<left <<"|";
  28. cout.width(0);
  29. cout <<item[row][col].Price << endl;
  30. </code></span>
  31. with differenct variations but just dosent work :'(
  32. any advice?
  33.  
  34. Thanks
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed

Re: displaying two dimensional array in columns help

 
0
  #2
Apr 24th, 2007
Perhaps other values besides width(0) ?
Reply With Quote Quick reply to this message  
Join Date: Apr 2007
Posts: 9
Reputation: sInFuL69er is an unknown quantity at this point 
Solved Threads: 0
sInFuL69er sInFuL69er is offline Offline
Newbie Poster

Re: displaying two dimensional array in columns help

 
0
  #3
Apr 24th, 2007
  1. i have tried other values but it jsut pushes the element further away.
  2. i cant get the element besides each other
Reply With Quote Quick reply to this message  
Join Date: Mar 2007
Posts: 6
Reputation: alejo is an unknown quantity at this point 
Solved Threads: 0
alejo alejo is offline Offline
Newbie Poster

Re: displaying two dimensional array in columns help

 
0
  #4
Apr 24th, 2007
use "setiosflags()" and setw() to manipulate the output. dont forget #include <iomanip>
for the decimal you may want to use "setprecision()" hope that helps.
Reply With Quote Quick reply to this message  
Reply

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


Thread Tools Search this Thread



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

©2003 - 2009 DaniWeb® LLC