#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");
}

Recommended Answers

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 developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.