[問題] a question about ==
in a simple programm for addition as follows:
#include <iostream>
using namespace std;
int main()
{
int x, y, sum;
cout << "Input the first integer: ";
cin >> x;
cout << "Input the second integer: ";
cin >> y;
sum == x + y;
cout << "The sum is: " << sum << endl;
system ("pause");
return 0;
}
what I've midified is swaping the "=" for "=="
I know their difference-- just want to see what will happen,
and whichever two numbers i give to it, the "sum" is always a specific number:
2294360
any explanation, please?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 59.117.201.149
推
10/16 18:57, , 1F
10/16 18:57, 1F
推
10/16 18:58, , 2F
10/16 18:58, 2F
→
10/16 18:58, , 3F
10/16 18:58, 3F
→
10/16 18:58, , 4F
10/16 18:58, 4F
→
10/16 18:59, , 5F
10/16 18:59, 5F
推
10/16 19:00, , 6F
10/16 19:00, 6F
→
10/16 19:00, , 7F
10/16 19:00, 7F
→
10/16 19:00, , 8F
10/16 19:00, 8F
推
10/21 00:02, , 9F
10/21 00:02, 9F