Advertisement
Alberts00

calc

Apr 20th, 2012
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. #include <cstdlib>
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main(int argc, char *argv[])
  7. {
  8.     double x;
  9.     double y;
  10.     char darbiba;
  11.     cout << "Ievadiet x"<<endl;
  12.     cin >> x;
  13.     cout << "Ievadiet y"<<endl;
  14.     cin >> y;
  15.     cout << "Kadu darbibu jus velaties veikt ar x un y"<<endl;
  16.     cin >> darbiba;
  17.    
  18.     if (darbiba == '+') {cout<< x+y <<endl;}
  19.     else if (darbiba == '-') {cout<< x-y <<endl;}
  20.     else if (y==0) {cout<< "Ar nulli dalit/reizinat nedrikst" <<endl;}  
  21.     else if (darbiba == '*') {cout<< x*y <<endl;}
  22.     else if (darbiba == '/') {cout<< x/y <<endl;}
  23.     else cout << "nav";
  24.     system("PAUSE");
  25.     return EXIT_SUCCESS;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement