C++ 希望修复main.cpp与'std::istream&;不匹配的问题<&书信电报;国际及';操作人员

C++ 希望修复main.cpp与'std::istream&;不匹配的问题<&书信电报;国际及';操作人员,c++,C++,首先,代码如下: #include <iostream> #include <stdlib.h> using namespace std; int add(int x,int y){ return x+y; } int sub(int x,int y){ return x-y; } int divide(int x,int y){ return x/y; } int mult(int x,int y){ return x*y; }

首先,代码如下:

#include <iostream>
#include <stdlib.h>
using namespace std;

int add(int x,int y){
    return x+y;
}

int sub(int x,int y){
    return x-y;
}

int divide(int x,int y){
    return x/y;
}

int mult(int x,int y){
    return x*y;
}

void operation(string operation,int x,int y){
    if(operation=="addition"){
        cout << add(x,y);
    }
    else if(operation=="subtraction"){
        cout << sub(x,y);
    }
    else if(operation=="multiplication"){
        cout << mult(x,y);
    }
    else if(operation=="division"){
        cout << divide(x,y);
    }
}
int main(int argc, char *argv[]){
  while(true){
    string operation;
    int x;
    int y;
    cout << "Please enter your operation: ";
    cin >> operation;
    cout << endl << "Please enter the first number: ";
    cin << x;
    cout << endl << "Please enter the second number: ";
    cin << y;
    cout << endl;
    operation(operation,x,y)
    }
  }
  system("PAUSE");  
  return 0;
}
#包括
#包括
使用名称空间std;
整数相加(整数x,整数y){
返回x+y;
}
int sub(int x,int y){
返回x-y;
}
整数除法(整数x,整数y){
返回x/y;
}
整数倍(整数倍,整数倍){
返回x*y;
}
无效操作(字符串操作,整数x,整数y){
如果(操作==“加法”){

请看一看。您应该为cin使用>。

应该是
cin>>x;
cin>>y;
。谢谢您的帮助!