求答疑

#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

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

posted on 2022-09-15 15:24  gryzy  阅读(47)  评论(1编辑  收藏  举报

导航