Hi I'm new to programming and I'm doing this project where I have to stimulate an ATM machine and do things the way they work, and I'm not supposed to use advanced functions we did not learn in class. It asks the user to input a letter to either withdraw, deposit or see balance or just quit, But it should keep asking until the user asks to quit which in this case is (Q,q). And for some reason, i get errors like expected unqualified-id before { token and expected , or ; before { token. I was wondering if anyone could help me with this, I really did try my best to work it out myself. Here is my C++ code, if anyone can help me I will be really grateful.
[tag]
Code:
#include <iostream>
#include <stdlib.h>
using namespace std;
void menu (void);
int main()
{
float number,result;
float numero = 5000.00;
void menu (void);
void check_balance(void);
char choice;
menu();
cin >> choice;
while(choice !='d' && choice != 'D' && choice != 'w' && choice != 'W' && choice != 'b' && choice != 'B' && choice != 'Q' && choice != 'q')
{
cout << "It's not a valid entry." << endl;
menu();
cin >> choice;
}
if (choice == 'd' || choice == 'D')
{
cout << "How much will you deposit?" << endl;
cin >> number;
}
result = (number + numero);
}
else if (choice == 'w' || choice == 'W')
{
cout << "How much will you withdraw?" << endl;
cin >> number;
result = (numero - number);
}
else if (choice == 'b' || choice == 'B')
{
void print_balance (void);
cout << "Your balance is " << balance << " dollars." << endl;
}
{
else (choice == 'q' || choice == 'Q')
return 0;
}
{
cout << "Thank you for your transaction! Your current balance is now " << result << " dollars." << endl;
cout << "What would you like to do now?" << endl;
return 0;
}
void menu(void);
{ cout << "Hello there!" <<endl;
cout << "Enter D or d for deposit." << endl;
cout << "Enter W or w for withdrawal." << endl;
cout << "Enter B or b for balance." << endl;
cout << "Enter Q or q to quit." << endl;
}
void print_balance(float);
{
if (balance == balance)
{
return 0;
}
else
{
return 1;
}
}
[/tag]
These are the errors I get
Code:
C:\Users\owner\Desktop\HW5.cpp:39: error: expected unqualified-id before "else"
C:\Users\owner\Desktop\HW5.cpp:39: error: expected `,' or `;' before "else"
C:\Users\owner\Desktop\HW5.cpp:46: error: expected unqualified-id before "else"
C:\Users\owner\Desktop\HW5.cpp:46: error: expected `,' or `;' before "else"
C:\Users\owner\Desktop\HW5.cpp:54: error: expected unqualified-id before '{' token
C:\Users\owner\Desktop\HW5.cpp:54: error: expected `,' or `;' before '{' token
C:\Users\owner\Desktop\HW5.cpp:60: error: expected unqualified-id before '{' token
C:\Users\owner\Desktop\HW5.cpp:60: error: expected `,' or `;' before '{' token
C:\Users\owner\Desktop\HW5.cpp:68: error: expected unqualified-id before '{' token
C:\Users\owner\Desktop\HW5.cpp:68: error: expected `,' or `;' before '{' token
C:\Users\owner\Desktop\HW5.cpp:78: error: expected unqualified-id before '{' token
C:\Users\owner\Desktop\HW5.cpp:78: error: expected `,' or `;' before '{' token