How to read data.txt file by read each single word.
for example,
Eddy Alfaro Gyrobifastigium Size: 1546 Qty: 78
possibly make looping after that.
ifstream myfile;
ofstream outfile;
if (!myfile)
{
cout << "Cannot open input file." << "Program terminate!" << endl;
return 1;
}
cout << "Enter file name to process: ";
cin >> filename;
myfile.open("data.txt");
cout << "Enter output file name:";
cin >> filename;
outfile.open("out.txt");
cout << "Would you like to process all the records in the file? (y/n)";
cin >> filename;
cout << "Enter number of records to process: ";
cin >> num;
cout << "Maximum requested record count of " << num << "reached\n";
cout << "File processing finished\n";
for (int record=1; record <=5; record++)
{
record+= record;
cout << "Record" << record << endl;
if(myfile.is_open() )
{
string firstName;
string lastName;
while (getline(myfile,firstName))
{
cout << firstName <<endl;
here is my coding.. When I type data.txt, it is not going to show next thing like "Enter your output file"... What should I need it from there?
Please check it all. I appreciated your help
Record 1
Eddy Alfaro Gyrobifastigium Size: 1546 Qty: 78 ----------------------------------------Calculations for a Gyrobifastigium
Edge Length: 1546 ----------------------------------------
Surface Area: 13700266
Square Feet Volume: 3200067215
Cubic Feet Height: 2678 Feet
Surface to Volume Ratio: 0.004
Order total volume require for delivery: 9244638621 Cubic Yards
Bronto-Dump trucks required 7395711
That's what I need to get.
this is an example of reading the data.txt
Enter file name to process: data.txt
Enter output file name: out.txt
Would you like to process all the records in the file? (y/n) n
Enter number of records to process: 5
Maximum requested record count of 5 reached