Output from one program cannot be read by another

Hi, this could well be impossible to answer with the information I have but just wanted to check. I have to create a mesh to be read by another program, the mesh is the placement of particles for certain spacings, and my output can't be read by the the program created by another person. I have no access to the code of this program so cannot check how it works the only thing I have is an example mesh:


total no. of points: 6321
1 0.005 4.9999999E-03
2 4.9999999E-03 9.9999998E-03
3 4.9999999E-03 1.5000000E-02
4 4.9999999E-03 2.0000000E-02
5 4.9999999E-03 2.5000000E-02
6 4.9999999E-03 2.9999999E-02
7 4.9999999E-03 3.5000000E-02
8 4.9999999E-03 3.9999999E-02
9 4.9999999E-03 4.5000002E-02
10 4.9999999E-03 5.0000001E-02
initial condition (x-velocity y-velocity volume)
1 0.8913000 0.0000000E+00 2.2148395E-05
2 0.8913000 0.0000000E+00 2.2148395E-05
3 0.8913000 0.0000000E+00 2.2148395E-05
4 0.8913000 0.0000000E+00 2.2148395E-05
5 0.8913000 0.0000000E+00 2.2148395E-05
6 0.8913000 0.0000000E+00 2.2148395E-05
7 0.8913000 0.0000000E+00 2.2148395E-05
8 0.8913000 0.0000000E+00 2.2148395E-05
9 0.8913000 0.0000000E+00 2.2148395E-05
10 0.8913000 0.0000000E+00 2.2148395E-05


There are a few 1000 particles in the full version but thought I should cut it down! I can add more if needed.

Here is the code I created:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#include <iostream>
#include <iomanip>
#include <fstream>

using namespace std;

int main()
{
	double c1x;
	double c2x;
	double c3x;
	double c1y;
	double c2y;
	double c3y;
	double how;
	double vol;
	double xv;
	double yv;
	double spacing;
	double cx;
	double cy;
	double nop;
	int n=1;

	ofstream outFile;
	outFile.open("mesh.mes");

	cout<<"Please enter x-value for co-ordinate 1:"<<endl;
	cin>>c1x;

	cout<<endl<<"Please enter y-value for co-ordinate 1:"<<endl;
	cin>>c1y;

	cout<<endl<<"Please enter x-value for co-ordinate 2:"<<endl;
	cin>>c2x;

	cout<<endl<<"Please enter y-value for co-ordinate 2:"<<endl;
	cin>>c2y;

	cout<<endl<<"Please enter x-value for co-ordinate 3:"<<endl;
	cin>>c3x;

	cout<<endl<<"Please enter y-value for co-ordinate 3:"<<endl;
	cin>>c3y;

	cout<<endl<<"Please enter height of water above bottom co-ordinate:"<<endl;
	cin>>how;

	cout<<endl<<"Please enter the spacing:"<<endl;
	cin>>spacing;

	cout<<endl<<"Please enter the particle volum:"<<endl;
	cin>>vol;

	cout<<endl<<"Please enter the x-velocity:"<<endl;
	cin>>xv;

	cout<<endl<<"Please enter the y-velocity:"<<endl;
	cin>>yv;

	if(c1y == c2y && c2x == c3x)
	{
		cx=c1x;
		cy=c1y;
		nop=(((c2x-c1x)/spacing)+1)*(((how)/spacing)+1);
		outFile<<"total no. of points:"<<"	"<<nop<<"\n";

		while(cx<=c2x)
		{
			while(cy<=(how+c1y))
			{
				outFile<<"	"<<n<<"	"<<cx<<"	"<<cy<<"	"<<"\n";
				cy=cy+spacing;
				n++;
			}
			outFile<<"	"<<n<<"	"<<cx<<"	"<<cy<<"	"<<"\n";
			n++;
			cx=cx+spacing;
			cy=c1y;
		}

		n=1;

		outFile<<"initial condition (x-velocity y-velocity volume)"<<"\n";

		while(n<=(nop))
		{
			outFile<<"	"<<n<<"	"<<xv<<"	"<<yv<<"	"<<vol<<"\n";
			n++;
		}
	}

	outFile.close();
	
	return 0;
}


I've tried it without the tabs between the file outputs as well with no joy. So in a nutshell how do I put my outputs into the same form as the table above? Any help is greatly appreaciated!

Thanks!
" "

Did you actually hit the tab key here? I think you must have meant this: "\t"
Haha, didn't know about "\t"! Well I won't be making that mistake again. It has been sorted now, turns out that the problem was in the first line of the output as it wants two spaces between the text and the number for whatever reason.

Thanks for your help.

Topic archived. No new replies allowed.