A
aejaz
Hey all
I am new to VC++
I want to have my c++ program output to a notepad file
i store my data in arrays and then use cout to output the data in
DOS...as i generate data in the order of 1000's ...i am having a
problem with physically copy pasting the data into notepad
Here is my code...please suggest what changes are necessary
My coding is not really that efficient..please bear with me
Thanks
Aejaz
# include<iostream.h>
# include<conio.h>
# include<math.h>
# include<iomanip.h>
void main()
{
void clrscr();
int i,r,j,m,x;
static Sum[5000][5000];
Sum[1][1]=25000;
Sum[2][1]=35000;
for (j=2;j<=11;j++) // input the data into arrays
for (i=1;i<=pow(2,j);i++)
{
if(i==1)
{
Sum[j] = Sum[j-1] + 25000;
Sum[i+1][j] = Sum[j-1] + 35000;
}
if(i>1)
{
Sum[j] = Sum[r][j-1] + 25000;
r=r+1;
Sum[i+1][j] = Sum[(i+1)/2][j-1] + 35000;
}
i=i+1;
r=2;
}
for (m=2;m<=11;m++) // output the data
{
for (x=1;x<=pow(2,m);x++)
{
for(i=1;i<=2;i++)
{
cout<<x<<m<<setw(10)<<Sum[x][m]<<endl;
}
}
getch();
}
}
my output reads
11 25000
11 25000
12 35000
12 35000
so on..so forth
I am new to VC++
I want to have my c++ program output to a notepad file
i store my data in arrays and then use cout to output the data in
DOS...as i generate data in the order of 1000's ...i am having a
problem with physically copy pasting the data into notepad
Here is my code...please suggest what changes are necessary
My coding is not really that efficient..please bear with me
Thanks
Aejaz
# include<iostream.h>
# include<conio.h>
# include<math.h>
# include<iomanip.h>
void main()
{
void clrscr();
int i,r,j,m,x;
static Sum[5000][5000];
Sum[1][1]=25000;
Sum[2][1]=35000;
for (j=2;j<=11;j++) // input the data into arrays
for (i=1;i<=pow(2,j);i++)
{
if(i==1)
{
Sum[j] = Sum[j-1] + 25000;
Sum[i+1][j] = Sum[j-1] + 35000;
}
if(i>1)
{
Sum[j] = Sum[r][j-1] + 25000;
r=r+1;
Sum[i+1][j] = Sum[(i+1)/2][j-1] + 35000;
}
i=i+1;
r=2;
}
for (m=2;m<=11;m++) // output the data
{
for (x=1;x<=pow(2,m);x++)
{
for(i=1;i<=2;i++)
{
cout<<x<<m<<setw(10)<<Sum[x][m]<<endl;
}
}
getch();
}
}
my output reads
11 25000
11 25000
12 35000
12 35000
so on..so forth