diff --git a/qualdev/compte-rendu_momentane.txt b/qualdev/compte-rendu_momentane.txt new file mode 100644 index 0000000000000000000000000000000000000000..91f02810fc9901973ea9725f5c035c5d8b3c83ef --- /dev/null +++ b/qualdev/compte-rendu_momentane.txt @@ -0,0 +1,84 @@ +git clone https://gitlab.univ-lorraine.fr/e0088u/tp-git + +------------------------------- Situation 1 ------------------------------------ + +1. touch alice.txt + +(quelques +lignes +.) + +2. git add alice.txt + +git commit -m "add alice.txt" + +5. git push + +8. Bob : git pull + +------------------------------- Situation 2 ------------------------------------ + +1. +(voici +quelques +lignes +.) +git commit -m "feat:Modify alice.txt" +git pull + +2. Bob: touch bob.txt + +3. Bob: git pull + +1. git commit -m "add bob.txt" + +2. +(et +voici +quelques +lignes +.) +git add alice.txt +git commit -m "feat: Modify alice.txt pour de vrai cette fois encore" +git push + +3. Bob : git pull + +4. Bob: git merge origin/main + +5. Bob: git push + +6. git pull + +1. +(et +voici +encore +quelques +lignes +.) + +2. echo "potatoes" >> bob.txt +git commit -m "Modify bob.txt" + +3. git push + +4.git pull git push + +5.git pull + +------------------------------- Situation 3 ------------------------------------ + +1. +(Alice was here +et +voici +encore +quelques +lignes +.) + +Ordre des git: +commit +puis pull +puis push diff --git a/qualdev/compte_rendu.txt b/qualdev/compte_rendu.txt new file mode 100644 index 0000000000000000000000000000000000000000..a3c6ac29e82220a9c7e77f794f0a511e370abf1e --- /dev/null +++ b/qualdev/compte_rendu.txt @@ -0,0 +1,45 @@ +4. git init +5. git status , après Fichiers non suivis +6. mkdir node_modules , touch package-lock.json , echo "node_modules" >> .gitignore , echo "package-lock.json" >> .gitignore +7. git add <fichier> +8. git status +9. git commit "add tous les elements non indexes" +10. git status + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +glpat-8sTSmVsVVkQWm-ex1Yzw diff --git a/src/TD2.ts b/src/TD2.ts new file mode 100644 index 0000000000000000000000000000000000000000..e29d6bab85e0da83d66807ce915359290ec56e09 --- /dev/null +++ b/src/TD2.ts @@ -0,0 +1,92 @@ +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~TD 2~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +// - - - - - - - - - - - - - afficheNbPaires - - - - - - - - - - - - - - - - - +function afficheNbPaires(n: number): Array<number> { + let tableauPaires: number[] = []; + for (let i = 0; i < n; i++) { + const valATester = prompt("Entrez un entier : "); + if (valATester) { + if (Number(valATester) % 2 === 0) { + tableauPaires.push(Number(valATester)); + } + } + } + return tableauPaires; +} +//console.log(afficheNbPaires(3)); + +// - - - - - - - - - - - - - ajouterUn - - - - - - - - - - - - - - - - - +function ajouterUn(tableau: Array<number>): void { + for (let i = 0; i <= tableau.length - 1; i++) { + tableau[i] += 1; + } +} + +/* let x = [1, 2, 3]; +ajouterUn(x); +console.log("x =", x); */ + +// - - - - - - - - - - - - - - - plusUn - - - - - - - - - - - - - - - - - +function plusUn(tableau: Array<number>): Array<number> { + let nouveauTableau = []; + for (let element of tableau) { + nouveauTableau.push(element + 1); + } + return nouveauTableau; +} + +/* let x = [1, 2, 3]; +let y = plusUn(x); +console.log("x =", x); +console.log("y =", y); */ + +// - - - - - - - - - - - - - - - rotationTableau - - - - - - - - - - - - - - - - - +function rotationTableau(tableau: Array<number>): void { + let dernierElement = tableau[tableau.length - 1]; + for (let i = tableau.length - 1; i >= 0; i--) { + if (i === 0) { + tableau[i] = dernierElement; + } + else { + tableau[i] = tableau[i - 1]; + } + } +} + +/* let x = [23, 28, 6, 49, 50]; +rotationTableau(x); +console.log(x); */ + +// - - - - - - - - - - - - - - - inverseTableau - - - - - - - - - - - - - - - - - +function inverseTableau(tableau: Array<number>): void { + let variableIntermediere: number; + for (let i = 0; i <= tableau.length / 2 - 1; i++) { + variableIntermediere = tableau[i]; + tableau[i] = tableau[tableau.length - i - 1]; + tableau[tableau.length - i - 1] = variableIntermediere; + } +} + +/* inverseTableau(x); +console.log(x); */ + +// - - - - - - - - - - - - - - - nombreTiragesDe - - - - - - - - - - - - - - - - - +function nombreTiragesDe(): void { + let tirageDe = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + let i = 0; + let tirage: number; + let verifSomme = 0; + while (i !== 10000) { + tirage = Math.floor(Math.random() * (12 - 2 + 1)) + 2; + tirageDe[tirage] += 1; + i++; + } + for (let i = 2; i <= tirageDe.length - 1; i++) { + console.log("somme = ", i, " : ", tirageDe[i], " tirages"); + } + for (let i = 2; i <= tirageDe.length - 1; i++) { + console.log("*".repeat(tirageDe[i] / 100)); + } +} + +nombreTiragesDe() \ No newline at end of file diff --git a/src/TDclasses.ts b/src/TDclasses.ts new file mode 100644 index 0000000000000000000000000000000000000000..264967c2baffa4944d884c628be4b2fefbf95ed7 --- /dev/null +++ b/src/TDclasses.ts @@ -0,0 +1,71 @@ +class Point { + x = 0; + y = 0; +} + +class Cercle { + rayon = 0; + centre = new Point(); +} + +let test = new Cercle(); +test.rayon = 75; +test.centre.x = 150; +test.centre.y = 100; + +function pointDansCercle(cercle: Cercle, point: Point): boolean { + let distance = Math.sqrt((cercle.centre.x - point.x) ** 2 + (cercle.centre.y - point.y) ** 2) + if (distance <= cercle.rayon) { + return true; + } + return false; +} + +let pointTest = new Point(); +pointTest.x = 151 +pointTest.y = 60 + +//console.log(pointDansCercle(test, pointTest)); + +function rectangleDansCercle(coin1: Point, coin2: Point, coin3: Point, coin4: Point, cercle: Cercle): boolean { + if (pointDansCercle(cercle, coin1) && pointDansCercle(cercle, coin2) && pointDansCercle(cercle, coin3) && pointDansCercle(cercle, coin4)) return true; + return false; +} + +function chevauchement(coin1: Point, coin2: Point, coin3: Point, coin4: Point, cercle: Cercle): boolean { + if (pointDansCercle(cercle, coin1) || pointDansCercle(cercle, coin2) || pointDansCercle(cercle, coin3) || pointDansCercle(cercle, coin4)) return true; + return false; +} + +class Temps { + heure: number; + minute: number; + second: number; +} + +function temps2Number(objet: Temps): number { + return (objet.heure * 3600) + (objet.minute * 60) + objet.second; +} + +test = new Temps() +test.heure = 1 +test.minute = 30 +test.second = 5 + +//console.log(temps2Number(test)); + +function number2Temps(temps: number): Temps { + let objet = new Temps(); + objet.heure = Math.trunc(temps / 3600); + temps %= 3600 + objet.minute = Math.trunc(temps / 60); + temps %= 60 + objet.second = Math.trunc(temps); + return objet; +} + +console.log(number2Temps(5405)); + +function multiplieTemps(temps: Temps, multiplieur: number): Temps { + return number2Temps(temps2Number(temps) * multiplieur); +} \ No newline at end of file