0% found this document useful (0 votes)
12 views3 pages

Assign 3 PF - 678 - Spring 2022

This document is an assignment submission for CS 111 PF due on April 18th 2022. It was submitted by Husnain Abbas and includes source code for a calculator program using switch statements.

Uploaded by

Abbas Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views3 pages

Assign 3 PF - 678 - Spring 2022

This document is an assignment submission for CS 111 PF due on April 18th 2022. It was submitted by Husnain Abbas and includes source code for a calculator program using switch statements.

Uploaded by

Abbas Ali
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Assignment 3

CS 111 PF

Due Date: 18-April-2022

Submitted by

Husnain Abbas

678-FBAS/BSIT/F21

Submitted to

Sir Sameer Akram Mirza

Lecturer – DCSSE, FBAS

Department of Computer Science and Software Engineering

INTERNATIONAL ISLAMIC UNIVERSITY ISLAMABAD

Semester Spring 2022


//Assign No. 3 - Q1
//Calculator with switch case
//Husnain Abbas, Reg. No. 678-FBAS/BSIT/F21

#include <iostream>
using namespace std;

int main()
{
char op;
int num1, num2;

cout << "Enter operator: /,*, +, -, % :";


cin >> op;

cout << "Enter two operands: ";


cin >> num1 >> num2;

switch(op)
{
case '/':
cout << num1 << " / " << num2 << " = " << num1 / num2 <<endl;
break;

case '*':
cout << num1 << " * " << num2 << " = " << num1 * num2 <<endl;
break;

case '+':
cout << num1 << " + " << num2 << " = " << num1 + num2 <<endl;
break;

case '-':
cout << num1 << " - " << num2 << " = " << num1 - num2 <<endl;
break;

case '%':
cout << num1 << " % " << num2 << " = " << num1 % num2 <<endl;
break;

default:
cout << "Error! Entered operator is not correct" <<endl;
break;
}

system ("pause");
return 0;
}

You might also like