i have this program but it will only read the first two values of my data file and the second value it reads as the first variable C , how do i fix this
// develop algorithm to balance checking account
// make transactions and charge service charges
#include<iostream> // required for keyboard and screen I/O
#include<fstream> // required for external file stream
#include<iomanip>
#include<conio.h>
#include<string>
using namespace std;
// associating program identifiers with external file names
char next_char; // used to hold end of line marker
char C , D , E , alphabet , Z ;
float beginning_balance ,cnumber , dnumber , service_charge_cheque , number;
float current_balance, service_charge_500 , service_charge_D;
float additional_service_charge;
ifstream ins; // associates ins as an input stream
ofstream outs; // associates outs as an output stream
ins.open(in_file);
outs.open (out_file);
while (!ins.eof()) // end of file
{
// begin with your starting balance
ins >> beginning_balance;
// output results to file
outs << "Your beginning balance is $" << beginning_balance << endl;
outs << endl;
ins >> alphabet;
C = alphabet;
D = alphabet;
E = alphabet;
if ( C = alphabet )
{
ins >> number;
outs << "You have cashed a cheque for $ " << number << endl;
outs << "You are charged a service charge of $0.15 is applied when cashing a cheque" << endl;
current_balance = beginning_balance - number - service_charge_cheque;
outs << "Your new account balance is $ " << current_balance << endl;
}
outs << endl;
if ( current_balance < 500.00 )
{
outs << "Your current account balance has dropped below $500.00"<< endl;
outs << "A service charge of $5.00 will be applied"<< endl;
current_balance = current_balance - service_charge_500;
outs << "Your current balance is $ " << current_balance << endl;
}
if ( D = alphabet )
{
ins >> number;
outs << "You have made a deposit of $ " << number << endl;
outs << "You will be charged a service fee of $0.10"<< endl;
current_balance = current_balance + number - service_charge_D;
outs << "Your current balance is $ " << current_balance << endl;
}
if (current_balance < 50.00 )
{
outs << "Warning: You have less than $50.00 in your account" << endl;
}
if (current_balance < 0 )
{
outs << "Your account has become negative " << endl;
outs << "An additional service charge of $1.00 will be ";
outs << "charged for everychque deposited until balance is positive" << endl;
number = number + additional_service_charge;
}
outs << endl;
if (alphabet != C || alphabet != D || alphabet != E )
{
outs << "error in transaction " << endl;
}
879.46
C 400.00
D 100.0
F 525.00
C 450.00
D 500.00
D 1000.00
C 2000.00
D 3000.00
D 3500.00
C 5500.00
C 500.00
B 200.00
C -235.00
D 250.00
H -500.00
D 500.00
E
and my output is :
Your beginning balance is $879.46
You have cashed a cheque for $ 400
You are charged a service charge of $0.15 is applied when cashing a cheque
Your new account balance is $ 479.31
Your current account balance has dropped below $500.00
A service charge of $5.00 will be applied
Your current balance is $ 474.31
You have made a deposit of $ 400
You will be charged a service fee of $0.10
Your current balance is $ 874.21