|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (6 bit)
Join Date: Oct 2002
Location: Ohio
Posts: 32
|
TAB in C++
Anyone know how to insert a tab in a cout statement? I have a value in an array that i want to tab each value... for example...
cout << currentLED[x].color << currentLED[x].voltage << currentLED[x].current << currentLED[x].bright << currentLED[x].angle << currentLED[x].partnum << endl; I want a tab between each part of the array where the << sign is Thanks in advance |
|
|
|
|
|
#2 |
|
Member (7 bit)
Join Date: Sep 2003
Posts: 90
|
Code:
cout << currentLED[x].color << "\t" currentLED[x].voltage << "\t" currentLED[x].current << "\t" currentLED[x].bright << "\t" currentLED[x].angle << "\t" currentLED[x].partnum << "\n"; AS |
|
|
|
|
|
#3 |
|
Member (6 bit)
Join Date: Oct 2002
Location: Ohio
Posts: 32
|
Thanks, but i get a ton of compile errors when i put in the stamenet you gave me... 22 errors
|
|
|
|
|
|
#4 |
|
Member (7 bit)
Join Date: Sep 2003
Posts: 90
|
what are they?
AS |
|
|
|
|
|
#5 |
|
Member (7 bit)
Join Date: Sep 2003
Posts: 90
|
Code:
cout << currentLED[x].color << "\t" << currentLED[x].voltage << "\t" << currentLED[x].current << "\t" << currentLED[x].bright << "\t" << currentLED[x].angle << "\t" << currentLED[x].partnum << "\n"; AS |
|
|
|
|
|
#6 |
|
Member (6 bit)
Join Date: Oct 2002
Location: Ohio
Posts: 32
|
Well, i do not get any errors now, but my output is really messed up. Are you allowed to tab when you are outputting a string? it gives me all these negative values
|
|
|
|
|
|
#7 |
|
Member (7 bit)
Join Date: Sep 2003
Posts: 90
|
it doesn't do that when you print out without the "\t"s?
it seems like it is casting it as an integer. that's weird. Code:
cout << "hello" << "\t" << 5 << "\t" << 10 << "\t" << "foobar" << "\n"; if you want, you can post some of the code, but i won't be back for two hours. AS |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|