Calculator should display the accumulated value after each operation
//FILE: PROGRAM3.CPP
//AUTHOR : AM NGUYEN
//COURSE NAME : CS210
//DATE :
// DESCRIPTION : A SIMPLE CALCULATOR
# include <iostream>
using namespace std;
void instruction();
int calculator (char);
void divide_by_zero ();
float do_next_op (char, float, float);
void main()
{
//input
char input;
float accum,num;
// instructions ();
accum = 0
//get input
cout<< " : " ;
cin >> input;
while (input != 'Q' && input != 'q' && input != '=')
{
cin >> num;
// Do op
accum = do_next_op (input, num, accum);
//display result
cout << " Result so far : " << accum << endl;
// get next operation
cout << "teo mun "<< endl ;
} // end not quit
cout << "Final result : "
system ("pause") ;
return 0 ;
}
//instruct user
void instruction()
cout <<" This program models a simple calculator which can add, subtract,multiply,divide, power" << endl;
cout << " the calculator accumulate value after each operation " << endl;
cout << " press Q to quit the program " << endl;
cout << " Have fun with my program " << endl<< endl;
// function do_next_op ()
//perform next operation
// input : operator, operand,and accumulated
//output : new result
float do_next_op (char op, float num, float total)
{
switch (op)
{
case ' + ' :
total += num
break;
case ' - ' :
total -= num
break;
case ' * ' :
total *= num
break;
case ' / ' :
total /= num
case ' ^ ' :
total ^= num
break ;
default :
cout << " syntax error"
<< endl;
}
it cause the error, please help me to fix those error, more over, I am not sure about the while, for ,do while statement, please explain more for me. thank you
the error is main must return int
I declared the void for main already
yes ,this is most likely my complete code