You should look how to convert
TXT file class capacity of the existing format is as follows:
2893.590 3648.2148 39.364 1.6 6.000
Hope that through software converted class capacity is as follows:
X: 2893.590 Y: 3648.2148 Z: 39.364 A: B: 1.6 6.000
CodePudding user response:
Each reading a line, and then replace the Spaces for the letters and:, the letter you control yourself, such as starting with xCodePudding user response:
Read with the fscanf (), then the fprintf () will be X, Y, Z, A, B, and read data combination, and then write to A file,"The scanf printf and series c + + functions introduction"
"Using flow implementation file to read and write"
Wish I could help you!
CodePudding user response:
# include & lt; Iostream>
# include & lt; Fstream>
# include & lt; string>
using namespace std;
Int main () {
Ifstream input (" ");//your name, the absolute best path
Ofstream output (" result. TXT ", ofstream: : out | ofstream: : app);
String a;
While (input & gt;> A)
{
Break the if (input eof ());
The output & lt; <"X" & lt;Input & gt;> a;
The output & lt; <"Y" & lt;Input & gt;> a;
The output & lt; <"Z:" & lt;Input & gt;> a;
The output & lt; <"A:" & lt;Input & gt;> a;
The output & lt; <"B:" & lt;}
Input. The close ();
The output. The close ();
return 0;
}