Processing math: 100%

求答疑

#include<bits/stdc++.h>
using namespace std;
int x;
int main()
{
	for(int i=1;i<=10;++i)
	{
		x++;
		cout<<x<<endl;
	}
	int x=100-x;
	cout<<x<<endl;
	return 0;
}

运行结果:

1
2
3
4
5
6
7
8
9
10
99

把程序改为:

#include<bits/stdc++.h>
using namespace std;
int x;
int main()
{
	x=10;
	int x=100-x;
	cout<<x<<endl;
	return 0;
}

输出结果为100

最后的问题为intx=100x;
第二个x到底是个啥?到底应该等于多少?
求高手赐教??

posted on   gryzy  阅读(49)  评论(1编辑  收藏  举报

< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8

导航

统计

点击右上角即可分享
微信分享提示