首页 > 试题广场 >

下面的程序由两个文件组成,该程序显示什么内容? fi

[问答题]
下面的程序由两个文件组成,该程序显示什么内容?
// filel.cpp
#include <iostream>
using namespace.std;
void other();
void another();
int x = 10;
int y;
int main()
{
     cout << x << endl;
     {
             int x = 4;
             cout << x << endl;
             cout << y << endl;
            }
            other();
            another();
            return 0;
     }
     void other();
{
     int y = 1;
     cout << "Other: " << x << ", " << y <<endl;
}
// file 2.cpp
#include <iostream>
using namespace std;
extern int x;
namespace
{
         int y = 4;
}
void another()
{
      cout << "another(): " << x << ", " << y << endl;
}


推荐
10
4
0
Other: 10, 1
another(): 10, -4
发表于 2018-05-08 08:40:58 回复(0)