02/02/2020, 20:36
int x=1;
int w = 3;
int z= 10;
int f(int y){
y=20;
throw E;
return (x++) + y;
}
int g(int y){
y=100;
try{
throw E;
}
catch E{ }
return (x++) + y;
}
try{
f(w);
}
catch E{ }
print (x,w,z);
z = g(w);
print (x,w,z);
04/02/2020, 00:20
04/02/2020, 00:52
var x: int = 1;
var w: int = 3;
var z: int = 10;
proc f(in y: int): int throws {
y = 20;
throw new owned Error();
const res = x + y;
x = x + 1;
return res;
}
proc g(in y: int): int throws {
y = 100;
try {
throw new owned Error();
} catch { }
const res = x + y;
x = x + 1;
return res;
}
try {
f(w);
} catch { }
writeln(x, " ", w, " ", z);
z = g(w);
writeln(x, " ", w, " ", z);
1 3 10
2 3 101
var x: int = 1;
var w: int = 3;
var z: int = 10;
proc f(ref y: int): int throws {
y = 20;
throw new owned Error();
const res = x + y;
x = x + 1;
return res;
}
proc g(ref y: int): int throws {
y = 100;
try {
throw new owned Error();
} catch { }
const res = x + y;
x = x + 1;
return res;
}
try {
f(w);
} catch { }
writeln(x, " ", w, " ", z);
z = g(w);
writeln(x, " ", w, " ", z);
1 20 10
2 100 101
var x: int = 1;
var w: int = 3;
var z: int = 10;
proc f(inout y: int): int throws {
y = 20;
throw new owned Error();
const res = x + y;
x = x + 1;
return res;
}
proc g(inout y: int): int throws {
y = 100;
try {
throw new owned Error();
} catch { }
const res = x + y;
x = x + 1;
return res;
}
try {
f(w);
} catch { }
writeln(x, " ", w, " ", z);
z = g(w);
writeln(x, " ", w, " ", z);
1 20 10
2 100 101
Skuola.net News è una testata giornalistica iscritta al Registro degli Operatori della Comunicazione.
Registrazione: n° 20792 del 23/12/2010.
©2000—
Skuola Network s.r.l. Tutti i diritti riservati. — P.I. 10404470014.
Powered by phpBB © phpBB Group - Privacy policy - Cookie privacy
phpBB Mobile / SEO by Artodia.