hi all, i need help in extracting data out of a txt file and then modify it.
this is the problem
i have a txt file (customer.txt) storing some data
account no. money
123 3000
293 2300
874 3400
and this is the output i have to show
Customer Purchase:
Enter account number of customer: 123
Customer 123
Balance: $3000.00
Please enter sale charge: 200.00
<<<Sale approved:>>>
New Balance for customer 102: $2800.00
can anyone help me with this problem im stuck with
1) extracting the customer account number and balance
2) splitting the balance from the string (since account number and balance is in 1 line)
2) modify the txt file with the new balance
this is a little part of the whole program
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
void main (void)
{
string acct_no;
cout<<"enter account: ";
cin>>acct_no;
ifstream myfile ("example.txt");
if (myfile.is_open())
{
// stuck at here
}
myfile.close();
}
}
it will be best if any sample source code or syntax is given so i can do the rest on my own. tyvm