Question: What will the following two-file program display? // file1.cpp #include using namespace std; void other(); void another(); int x = 10; int y; int main()
What will the following two-file program display?
// file1.cpp
#include
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
using namespace std;
extern int x;
namespace
{
int y = -4;
}
void another()
{
cout << "another(): " << x << ", " << y << endl;
}
Step by Step Solution
3.40 Rating (156 Votes )
There are 3 Steps involved in it
I need to make a program that prompts the user for the names of ... View full answer
Get step-by-step solutions from verified subject matter experts
