Last active
December 23, 2021 18:28
-
-
Save zindmax/fcd5a13ff48d326fe5580fa20648b4f4 to your computer and use it in GitHub Desktop.
lab_7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def myfunc1(): | |
x = "John" | |
def myfunc2(): | |
nonlocal x | |
x = "hello" | |
myfunc2() | |
return x | |
print(myfunc1()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
void dswap(double *x, double *y) { | |
double t=*x; | |
*x=*y; | |
*y=t; | |
} | |
int main() { | |
double x=1.5, y=3.4; | |
dswap(&x, &y); | |
cout << x << " " << y; | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int rec(int x) { | |
return rec(x+1); | |
} | |
int main() { | |
cout << rec(1); | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A { | |
static int x = 1; | |
} | |
public class Main | |
{ | |
public static void main(String[] args) { | |
A a_1 = new A(); | |
A a_2 = new A(); | |
System.out.println(a_1.x + " " + a_2.x); | |
A.x = 10; | |
System.out.println(a_1.x + " " + a_2.x); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment