/***************************************************
A Very Simple Calculator
Write a program that reads from the user a simple
arithmetic expression using + and -, like
3 + 4 - 7 + 2 - 4 =
and prints out the value of the expression.
***************************************************/#include <iostream>usingnamespacestd;intmain(){cout<<"Enter an expression: ";// Initialize total to 0inttotal, k;charop;total=0;op='+';// Loopwhile(op!='='){// read next valuecin>>k;// add or subtract value from totalif(op=='+')total=total+k;elsetotal=total-k;// read next opcin>>op;}// Write resultcout<<total<<endl;return0;}