I am tring to convert integer to string and using string for further find and replace operations. While doing so I am using for loop to for integers and then wants to store all these integers in strings.
But I did not succeed. But If I use only one integer I can convert it into string and use it for further operations.
The program basic is as follows:
As I want to find certain numbers e.g suppose ranging from 60001 to 60010 at various locations in the file and then replacing them with some other strings.
As stated above I am just briefing my program to you
The program basic is like I have one input file inpt.txt
Shri
600001
600003
Proactive
600004
600006
First I am reading this input file. Now I have other input1.txt file as
600001
I went to college
600002
I don't go to college.
It is tedious program
6000003
Shridhar Ram Rahim
6000004
Very Easy Program
6000005
Life is nice
6000006
Now I want to take input from input.txt use it in input1.txt and produce the output.txt file as foloows:
600001:shri
I went to college
600002:shri
I don't go to college.
It is tedious program
6000003:shri
Shridhar Ram Rahim
6000004:Proactive
Very Easy Program
6000005:Proactive
Life is nice
6000006:Proactive
Please help me as I could able to produce output.txt fie but I could not repeat it for other numbers
Thank you
You want to take inpt.txt data and input1.txt data and mash data together and make a new file called output.txt. I don't really understand your system of how you're going to actually know where to put data from inpt.txt and input1.txt to actually logically come up with output.txt
I thought for a second that shri.... ok I get it now. Your numbers are messed up in inpt.txt though.
I don't get how your generating these magical numbers.... Why do you need them?
Do you want to parse a file for a number then match that number in another file resulting in modified output that goes in a completely different file?
$POINT ID = 600001
I went to college
$POINT ID = 600002
I don't go to college.
It is tedious program
$POINT ID = 6000003
Shridhar Ram Rahim
$POINT ID = 6000004
Very Easy Program
$POINT ID = 6000005
Life is nice
$POINT ID = 6000006
My program is
#include<iostream>
#include<string>
#include<fstream>
#include<iomanip>
#include<sstream>
using namespace std;
struct NVH
{
char name[200];
int points[200];
};
int main()
{
ifstream file;
file.open("input.txt");
ifstream pch;
pch.open("input1.txt");
char input2[300],name2[300];
ofstream pchout;
pchout.open("output.txt");
struct NVH n[200];
long int i,j,k,l,m,p,a,b,c,x,y,z,r,s,d,f;
float e;
long int g,h,t;
int u=900,v=400,w=700;
char nam[300],name[300],input[300],name1[300];
string line;
$POINT ID = 600001Shri
I went to college
$POINT ID = 600002
I don't go to college.
It is tedious program
$POINT ID = 6000003
Shridhar Ram Rahim
$POINT ID = 6000004
Very Easy Program
$POINT ID = 6000005
Life is nice
$POINT ID = 6000006
BUT I want output.txt as
$POINT ID = 600001Shri
I went to college
$POINT ID = 600002Shri
I don't go to college.
It is tedious program
$POINT ID = 6000003Shri
Shridhar Ram Rahim
$POINT ID = 6000004Proactive
Very Easy Program
$POINT ID = 6000005Proactive
Life is nice
$POINT ID = 6000006Proactive
Please help me as I almost done the correct program but I think Only problem as you stated I could not repeat the loop in file.