![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Jan 2006
Location: London, Ontario, Canada
Posts: 16
Rep Power: 0
![]() |
Hi everyone,
Really appreciate all the great help in the past. This might be something very simple but because I am new to C++, I don't know it. If I wanted to print out a set of numerical data from a 'cout' or 'out' statement so that the data is formatted into 2 columns in such a way that it will be read as 2 separate columns in a spreadsheet. cout << a << b << endl; or out << a << b << endl; Where 'a' and 'b' would be variables generating a stream of numerical data. I have tried the '\t' and 'setw (n)' options but it doesn't format it into 2 separate columns of data that can be read by a spreadsheet. Is there another function or manipulator that I am unaware of that can accomplish this task? Thanks a lot, really appreciate it.
__________________
Greatness courts failure and solitude. --- Anonymous |
|
|
|
|
|
#2 |
|
Expert Programmer
Join Date: Jun 2005
Posts: 852
Rep Power: 4
![]() |
Try
cout << a << "," << b << endl; |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Jan 2006
Location: London, Ontario, Canada
Posts: 16
Rep Power: 0
![]() |
Thanks a lot "The Dark"!!
That worked really well. Renaming the output file to (.csv) made a big difference. Really appreciate it.
__________________
Greatness courts failure and solitude. --- Anonymous |
|
|
|
|
|
#4 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5
![]() |
In Excel you can change the character you want to use as delimiter in a comma seperated value(csv) file if you wish.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for." -- Socrates |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|