No products in the cart.

write a c++ program that invokes …

CBSE, JEE, NEET, CUET

CBSE, JEE, NEET, CUET

Question Bank, Mock Tests, Exam Papers

NCERT Solutions, Sample Papers, Notes, Videos

write a c++ program that invokes a function calc() which intakes 2 integers and an arithmetic operator and prints the correspounding result

  • 1 answers

Bindu Agarwal 7 years, 11 months ago

#include <iostream>

using namespace std;

void calc(int a, int b, char c){

float r;

if(c=='+'){

r=a+b;

}

else if(c=='-'){

r=a-b;

}

else if(c=='*'){

r=a*b;

}

else{

r=a/b;

}

cout<<r<<endl;

}

int main(){

int a,b;

cin>>a>>b;

char c;

cin>>c;

calc(a,b,c);

return 0;

}

http://mycbseguide.com/examin8/

Related Questions

Define packages
  • 0 answers
What is alu
  • 1 answers
Write a program for swapping two numbers?
  • 0 answers
Write a program for swapping two numbers
  • 1 answers

myCBSEguide App

myCBSEguide

Trusted by 1 Crore+ Students

Test Generator

Test Generator

Create papers online. It's FREE.

CUET Mock Tests

CUET Mock Tests

75,000+ questions to practice only on myCBSEguide app

Download myCBSEguide App