Question
modify and extend the program #include using namespace std; #include using namespace std; int main() { float num=0; float total=0; char symbol; cout < <
modify and extend the program
#include
using namespace std;
#include
Using a do-while loop. Recall that in a post-test loop, the loop body must execute once before the exit condition is checked. Therefore, to use a post-test loop, we have to change the way we implement the strategy. This can be done as follows:
initialize total as zero; initialize operator as +; read num; process num (add or subtract from total, depending on operator); read next operator; If (operator is =) exit and print total. read num; ... Translate this into C++ code, compile and test in a script session
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started