答案:3.4 运行截图:附上程序:#include <iostream>using namespace std;int main(void){ int x, y; cin >> x; // 输入x的值 if (x <= -1) y = x - 1; else if (x > -1 && x <= 2) y = 2 * x; else y = x * (x + 2); cout << y << endl; system("PAUSE>NUL"); return 0;}
3.4
运行截图:
附上程序:
#include <iostream>using namespace std;
int main(void){ int x, y; cin >> x; // 输入x的值 if (x <= -1) y = x - 1; else if (x > -1 && x <= 2) y = 2 * x; else y = x * (x + 2); cout << y << endl; system("PAUSE>NUL"); return 0;}
上一个:c++编程改错~~下一个:C++编程分析