For some reason I am getting error C2448 from microsoft visual studios. I am trying to call a function but it is not wanting to work for me. Does anyone see what is wrong? I am trying to call 3 functions during the while statement with an if inside of it however it I thought that was how to call a function however it isn't working for me. Any input is appreciated.
#include <string>
#include <iostream>
using namespace std;
//int check (cbal && scharge);
//int deposit (cbal && scharge);
//int endt (cbal && scharge && loopend);
int main()
{
float cbal;
float scharge;
float bal;
char selection;
int loopend;
loopend = 1;
cout << "Transactions will take the form of a letter followed by a dollar amount. " <<
"Valid letters are “C” for a check, “D” for a deposit, and “E” for the ending " <<
"transaction(use zero on this transaction). Press <Enter> after each line of input!" << endl;
cout << "Please enter inital balance: ";
cin >> bal;
bal = cbal;
while(loopend == 1)
{
cout << "Please enter a transaction" << endl;
cin >> selection;
if (selection == 'C' || selection == 'c')
{
int check (float cbal, float scharge);
}
else if (selection == 'D' || selection == 'd')
{
int deposit (float cbal, float scharge);
}
else if (selection == 'E' || selection == 'e')
{
int endt (float cbal,float scharge, int loopend);
}
else
{
cout << "Please enter a valid transaction.";
}
}
return 0;
}
int check (float cbal, float scharge)
{
int transaction;
bool flag;
scharge = scharge + .15;
cout << "What is the check amount?" << endl;
cin >> transaction;
cbal = cbal - transaction;
cout << "Transaction ammount: " << transaction << endl
<< "Current Balance: " << cbal << endl
<< "Service Charge Check: $0.15" << endl;
if (cbal < 500 && flag == false)
{
scharge = scharge + 5;
flag = true;
cout << "Service Charge Below $500: $5.00";
}
cout << "Total Service Charges: " << scharge;
return (cbal);
return (scharge);
}
int deposit(float cbal, float scharge)
{
int transaction;
scharge = scharge + .10;
cout << "What is the deposit amount?" << endl;
cin >> transaction;
cbal = cbal + transaction;
cout << "Deposit amount: " << transaction << endl
<< "Current Balance: " << cbal << endl
<< "Service Charge Deposit: $0.10" << endl
<< "Total Service Charges: " << scharge;
return (cbal);
return (scharge);
}
int endt (float cbal, float scharge, int loopend)
{
int transaction;
cout << "Enter transaction amount: ";
cin >> transaction;
if (transaction == 0)
{
cout << "Transaction: End" << endl
<< "Current Balance: " << cbal << endl
<< "Total Service Charges: " << scharge << endl;
cbal = cbal - scharge;
cout << "Final Balance: " << cbal;
loopend = 2;
}
else
cout << "Error: 0 was not the transaction amount";
return (cbal);
return (scharge);
return (loopend);
}