为什么cout赋予不同的价值

Kam*_*zad -5 c++

#include <iostream>
using namespace std;
int main()
{
    int sum,a,b;
    a=4;
    b=4;
    sum=a+b;
    cout<<sum;
    cout<<sum;

}
Run Code Online (Sandbox Code Playgroud)

Q1为什么cout没有执行两次?
Q2为什么第二个cout给出不同的值?

eer*_*ika 5

为什么cout没有执行两次?

它执行两次。

为什么第二母题给出不同的价值?

两个输出均为8。

If that's not the case for you, then there may be something wrong with your compiler, your computer, the operating system, or maybe you are running a different program.

  • 您忘记提及输出差异的另一个可能原因-矩阵故障。 (2认同)