42 lines
1.1 KiB
C#
Raw Permalink Normal View History

2022-09-08 08:53:24 +02:00
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);
}
2022-09-08 15:40:21 +02:00
private static void Excercice2() {
Console.WriteLine("Veuillez saisir un texte : ");
String s = Console.ReadLine();
Console.WriteLine("Vous avez saisi : «" + s + "»");
}
private static void TestExcercice2() {
Excercice2();
}
2022-09-08 08:53:24 +02:00
public static void Launch() {
2022-09-08 15:40:21 +02:00
TestExcercice2();
2022-09-08 08:53:24 +02:00
}
}
}