Guipborges 0 Newbie Poster

Hi everybody.
I have a simple problem. Need send the c++ output to excel(csv->xls or xls direct) in formated data. I can send the data to excel, but i can´t format that like this:

|_ col 1__|___col 2___|___col n____|
row 1......|....2row 1
row 2......|....2row 2
row 3......|... 2row n

What i can´t, is go to begin in col 2. My code put the data in this way.

|_ col 1__|___col 2___|___col n____|

row 1
row 2
row n

I don´t set this pointer to next columns.
If i put the data in the same "for", i can put the data in way i need. Else, i do not.
But, the column 2, have a leght biger then column 1, and I need 2 "for" to put the data.
Follow the code.

#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <cstdlib>
#include <stdlib.h>

using namespace std;

class DATA
    int dados[5];
    int dados2[7];


int main()

   DATA c;

    for (int i = 0; i < 5; ++i)
        c.dados[i]= i;
   for (int i = 0; i < 7; ++i)
        c.dados2[i]= i;

    ofstream out;"data.txt");

     out << "DADOS 1"<<",";

    for (int i = 0; i < 5; ++i)
    out  << c.dados[i] <<",";

     out << "DADOS 2"<<",";

    for (int i = 0; i < 7; ++i)
    out  <<  c.dados2[i] <<",";

    system("RELATORIO.xlsx"); //open excel and import a data.txt to format xls

    return EXIT_SUCCESS;

this code put the data in rows, like a


this is the way I found to get my data, but is not the way I want

Any help??