#include <cstdlib>
#include <iostream>
using namespace std;
int main()
{
    float op1,op2,answer;
    char op;
    cout<<"Entre the first numper";
    cin>>op1;
    cout<<"/nEnter the operation";
    cin>>op;
    cout<<"/nEntre the second numper";
    cin>>op2;

    if(op=='+')
    answer=op1+op2;

    if(op=='-')
    answer=op1-op2;

    if(op=='*')
    answer=op1*op2;

    if(op=='/')
    answer=op1/op2;


    else
    cout<<op1<<op<<op2<<" = "<<answer;
    system("PAUSE");
}
c++

Recommended Answers

Yes? And your question is?

Jump to Post

All 3 Replies

Yes? And your question is?

Try if-else if- pattern

lmao no question ahahah

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.