对输入数值作大小判断
#include <iostream>
int main() // x, y created here
{
std::cout<< “Enter an integer: “;
int x; // x init … here
std::cin >> x;
std::cout<< "Enter a larger integer: ";
int y; // y init... here
std::cin >> y;
//Swapping the values
if(x > y){
int temp; //temp init... here
temp = x;
x = y;
y = temp;
std::cout<< "The smaller value is: "<< x << std::endl;
std::cout<< "The bigger value is: "<< y << std::endl;
} // temp dies here
else
{
std::cout<< "The smaller value is: "<< x << std::endl;
std::cout<< "The bigger value is: "<< y << std::endl;
}
//else
// std::cout<< "SOrry, I cannot compare, because "<< " x is: "<<x <<" and y is: "<<y << std::endl;
return 0;
} // x , y dies here