I am working on the program for class that im taking and its not working this is the algorithm that Im using but I dont know if im doing it right
Note: I am very new to this
Algorithm Name: UPDATE_CHECKBOOK
Problem Input(s): start_balance - the beginning checkbook balance. xact_amount - the amount of the transaction. xact_type - the type of the transaction (credit or debit). Problem Output(s): new_balance -- the ending checkbook balance. Relevant Formula(s): Adding a credit = (starting balance) + (transaction amount) Subtracting a debit = (starting balance) - (transaction amount) Algorithm:
BEGIN
Ask the user for the starting balance.
Input the starting balance (start_balance).
Ask the user for the transaction amount.
Input the amount of the transaction (xact_amount).
Ask the user for the type of transaction.
Input the type of transaction (xact_type).
If (the value of xact_type is "Credit") Then
Compute new_balance = (start_balance + xact_amount).
Else
Compute new_balance = (start_balance - xact_amount).
End If
Output the desired value (new_balance).
END
Heres what I have
float main()
{
float start_balance, xact_amount, xact_type, new_balance, credit, debit;
cout << "Please the starting balance: ";
cin >> start_balance;
cout << "Please enter the transaction amount: ";
cin >> xact_amount;
cout << "Please enter the type of transaction: ";
cin >> xact_type;
if (xact_type = credit) {new_balance = start_balance + xact_amount;}
else if (xact_type = debit) {new_balance = start_balance - xact_amount;}
return 0;
}
HELP ME! Please