Compare commits

...
Author SHA1 Message Date
didier amyot 021aa017f3 added things 2023-08-15 09:28:29 -04:00
6 changed files with 159 additions and 18 deletions

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"dotnet.defaultSolution": "FirstProject.sln",
"editor.fontSize": 14,
"editor.fontSize": 20,
"window.zoomLevel": 1,
"terminal.integrated.fontSize": 14,
"workbench.tree.indent": 23
+37
View File
@@ -0,0 +1,37 @@
namespace Algorithms;
using System;
using Algorithms.NumberTheory;
class SolutionExercices1 {
public static string removeTitle(string header)
{
int idx = header.IndexOf(".");
return header.Substring(idx + 1);
}
public static void printEachDirectoryOnPath(string path)
{
string[] subs = path.Split(':');
foreach (var sub in subs)
{
Console.WriteLine(sub);
}
}
public static void Main_(String[] args){
// {titre}.{sous-titre}.{sous-sous- titre}
// 4.56.2 -> 56.2
// 4.b.ii -> b.ii
string header = "4.56.2";
Console.WriteLine(removeTitle("4.56.2")); // "56.2"
Console.WriteLine(removeTitle("4.b.ii")); // "b.ii"
Console.WriteLine(removeTitle("")); // ""
Console.WriteLine(removeTitle("4.b")); // "b"
string? path = Environment.GetEnvironmentVariable("PATH");
printEachDirectoryOnPath(path ?? "");
}
}
+15
View File
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Algorithms.NumberTheory;
class Simple
{
internal double d;
public Simple(double d) {
this.d = d;
}
}
+64
View File
@@ -0,0 +1,64 @@
namespace Algorithms;
using System;
class Point
{
private double x;
private double y;
public Point(double x, double y)
{
this.x = x;
this.y = y;
}
public double X()
{
return x;
}
public double Y()
{
return y;
}
public double Distance()
{
return Math.Sqrt(X() * X() + Y() * Y());
}
}
class Point2
{
private double x;
private double y;
public Point2(double x, double y)
{
this.x = x;
this.y = y;
}
public double X
{
get => x;
set => x = value;
}
}
class Manager
{
internal string name;
private int level;
public Manager(string name, int level){
this.name = name;
this.level = level;
}
}
+19 -17
View File
@@ -1,26 +1,28 @@
// See https://aka.ms/new-console-template for more information
namespace Algorithms;
using System;
using Algorithms.NumberTheory;
class Point{
private double x;
private double y;
public Point(double x, double y){
this.x = x;
this.y = y;
class Program
{
public static void printEachDirectoryOnPath(string path)
{
string[] subs = path.Split(':');
foreach (var sub in subs)
{
Console.WriteLine(sub);
}
}
public double Distance(){
return Math.Sqrt(x * x + x * y);
}
}
class Foo{
public static void Main(String[] args){
Point p = new Point(3, 4);
Console.WriteLine("Hello World From A Class: " + p.Distance());
public static void Main(String[] args)
{
Point point = new Point(0, 0);
Point point2 = new Point(10, 10);
Console.WriteLine("La valeure de X de point est: " + point.X());
Console.WriteLine("La valeure de X de point2 est: " + point2.X());
}
}
+23
View File
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Algorithms;
class TrigonometryUtil {
public static double Side(double hypothenuse, double otherSide){
return Math.Sqrt(hypothenuse * hypothenuse - otherSide * otherSide);
}
public static double Hypothenuse(double a, double b){
return Math.Sqrt(a * a + b * b);
}
public static double Area(double hypothenuse, double side){
double otherSide = Side(hypothenuse, side);
return side * otherSide * 0.5;
}
}