static int x = 1; int y = x * 2; void t1() { y++; } void t2() { } void t3() { } cout << "x: " << x << " | y: " << y << e

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: 899603
Joined: Mon Aug 02, 2021 8:13 am

static int x = 1; int y = x * 2; void t1() { y++; } void t2() { } void t3() { } cout << "x: " << x << " | y: " << y << e

Post by answerhappygod »

Static Int X 1 Int Y X 2 Void T1 Y Void T2 Void T3 Cout X X Y Y E 1
Static Int X 1 Int Y X 2 Void T1 Y Void T2 Void T3 Cout X X Y Y E 1 (56.78 KiB) Viewed 20 times
static int x = 1; int y = x * 2; void t1() { y++; } void t2() { } void t3() { } cout << "x: " << x << " | y: " << y << endl; y += 1; x = -1; } void t4() { 2. int* x = &y; cout << "x: " << x <<" | y: "<<y << endl; } int main() { 3. 4. int y = x; static int x = 2; cout << "x: " << x + 1 << " | y: " << y + x << endl; x += y; 5. int y = x + 1; int& z = y; z += -1; cout << "x: " <<x+z<< " | y: "<<y << endl; This program outputs 5 lines. What are they? 1. vector<int> vec1 { 1, 3, 5, 7, 9 }; vector<int> vec2{ 2, 4, 6, 8, 10 }; vec1.swap(vec2); int* ptr = &vec1[1]; y = *(ptr + 2); t1(); t2(); t3(); t3(); t4(); return 0;
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply