What does the following program print?
笔试题一枚。
#include <iostream>
#include <vector>
using namespace std;
void print(vector<int>);
int main(int argc, char* argv[])
{
int x=2,y,z;
x *= (y=z=5);
cout << x << endl;
z=3;
x ==(y=z); //y=z=3,x未变
cout << x << endl;
x = (y==z); //y==z为真,
cout << x << endl;
x = (y&z);
cout << x << endl;
x = (y&&z);
cout << x << endl;
y = 4;
x = (y|z);
cout << x << endl;
x = (y||z);
cout << x << endl;
return 0;
}
answer:10,10,1,3,1,7,1
浙公网安备 33010602011771号