calc - { if(op=='+') res=lval+rval; else if(op=='-')...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
p #include <iostream> # using namespace std; u int main() { cout<<"please enter expression (we can handle +,-,*, and /):"; int lval; int rval; char op; int res; cin>>lval>>op>>rval; while(cin>>lval>>op>>rval)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { if(op=='+') res=lval+rval; else if(op=='-') res=lval-rval; else if(op=='*') res=lval*rval; else if(op=='/') res=lval/rval; r cout<<"Result:"<<res<<'\n'; } return(0); r }...
View Full Document

This note was uploaded on 03/28/2011 for the course ECE 315 taught by Professor Staff during the Spring '06 term at North Texas.

Ask a homework question - tutors are online