Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/ / functions prototypes static int x = 1 ; int y = x * 2 ; int main ( ) { vector vec 1

// functions prototypes
static int x =1;
int y = x *2;
int main(){
vector vec1{1,3,5,7,9,11,13,15};
vector vec2{0,2,4,6,8,10};
vec1.swap(vec2);
int* ptr = &vec2[7];
y =*(ptr -2);
t1();
t2();
t3();
t3();
t4();
return 0;
}
void t1(){
cout <<"x: "<< x <<"| y: "<< y << endl;
y -=8;
x +=-1;
}
void t2(){
int& x = y;
x += ::x++;
cout <<"x: "<< x <<"| y: "<< y << endl;
}
void t3(){
int y = x;
static int x =2;
cout <<"x: "<< x +1<<"| y: "<< y +2<< endl;
x += y;
}
void t4(){
int y = x + ::x;
int& z = ::y;
z +=-1;
cout <<"x: "<< x + z <<"| y: "<< y << endl;
}
This program outputs 5 lines. What are they?
1.
2.
3.
4.
5.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management With Website Development Applications

Authors: Greg Riccardi

1st Edition

0201743876, 978-0201743876

More Books

Students also viewed these Databases questions

Question

Persuading Your Audience Strategies for

Answered: 1 week ago