Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please edit MY code, to implement the ^ to be able to calculate squares. My code right now can only add and subtract, and is

Please edit MY code, to implement the "^" to be able to calculate squares. My code right now can only add and subtract, and is able to identify ";" as the end of a formula and it reads through the redirected file to see if there is more, and prints the sum of each seperate formula. Please see the example in the task description, and use the hint if possible.
image text in transcribed
image text in transcribed
Write an even better calculator program calc3.cpp that can understand squared numbers. We are going to use a simplified notation X^ to mean X?. For example, 10^ + 7 - 51" should mean 102 + 7 - 512 Example: When reading input file formulas.txt 5; 1000 + 6" - 5+ 1; the program should report: $ ./calc3 using namespace std; int main() { int s, sum=0; cin>>sum; char op; while(cin>>op>>s) { if(op == ';'){ cout

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Fred R. McFadden, Jeffrey Slater, Mary B. Prescott

5th Edition

0805360549, 978-0805360547

More Books

Students also viewed these Databases questions