td1 ex1
This commit is contained in:
31
TD1/td1.cs
Normal file
31
TD1/td1.cs
Normal file
@ -0,0 +1,31 @@
|
||||
using System;
|
||||
|
||||
namespace Programmation_objet_TLESIO21.TD1 {
|
||||
public static class Td1 {
|
||||
|
||||
private static void Excercice1(ref int a, ref int b) {
|
||||
(a, b) = (b, a);
|
||||
}
|
||||
|
||||
private static void TestExcercice1() {
|
||||
Console.Write("Saisir a : ");
|
||||
String s = Console.ReadLine();
|
||||
int a = int.Parse(s);
|
||||
|
||||
Console.Write("Saisir b : ");
|
||||
s = Console.ReadLine();
|
||||
int b = int.Parse(s);
|
||||
|
||||
|
||||
Console.WriteLine("Avant inversion, a = " + a + " & b = " + b);
|
||||
Excercice1(ref a, ref b);
|
||||
Console.WriteLine("Après inversion, a = " + a + " & b = " + b);
|
||||
}
|
||||
|
||||
public static void Launch() {
|
||||
TestExcercice1();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user