Answer to Question #272151 in C++ for captainwycliffe

Question #272151

Can someone give me any alogrithims that show all functions in a calculator

1
Expert's answer
2021-11-27T11:34:16-0500
#include <iostream>

double calc(double a, char op, double b)
{
  switch(op) {
    case '+':
      return a + b;
    case '-':
      return a - b;
    case '*':
      return a * b;
    case '/':
      return a / b;
    default:
      throw error('operator not implemented');
  }
}

int main() {}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS