Given the following program #include using namespace std; void f( int , int & ); void g(); int x = 10; int ma

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Given the following program #include using namespace std; void f( int , int & ); void g(); int x = 10; int ma

Post by answerhappygod »

Given the following program
#include <iostream>
using namespace std;
void f( int , int & );
void g();
int x = 10;
int main()
{
int x = 88, y = 50;
cout << "x before = " << x << ",y before = "
<< y << endl;
f( x, y);
cout << "x after f = " << x << ",y after f =
"<< y << endl;
g();
g();
cout<<" x = "<<::x<<endl;
return 0;
}
void f ( int x, int& y)
{
x ++;
y ++;
cout << " x in f= "<< x << ", y in f = "
<< y << endl;
}
void g( )
{
static int x = 10;
cout << " x in g = "<<x<< endl;
x++;
}
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply