Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
typescript_BOGUET_Thomas
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BOGUET Thomas
typescript_BOGUET_Thomas
Commits
dc20534e
Commit
dc20534e
authored
1 week ago
by
BOGUET Thomas
Browse files
Options
Downloads
Patches
Plain Diff
rendu td3
parent
fd2c1f5f
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
qualdev/Td_debug/exercice.ts
+19
-1
19 additions, 1 deletion
qualdev/Td_debug/exercice.ts
qualdev/compte_rendu.txt
+12
-1
12 additions, 1 deletion
qualdev/compte_rendu.txt
qualdev/td exeption.ts/td_exeption.ts
+92
-0
92 additions, 0 deletions
qualdev/td exeption.ts/td_exeption.ts
with
123 additions
and
2 deletions
qualdev/Td_debug/exercice.ts
+
19
−
1
View file @
dc20534e
...
...
@@ -54,7 +54,7 @@ function deb5(): number {
}
console
.
log
(
deb5
());
// exercice6
.ts
// exercice6
let
tab1
=
[
1
,
2
,
3
];
let
tab2
=
tab1
;
tab1
[
1
]
=
5
;
...
...
@@ -65,3 +65,21 @@ let tab4 = [...tab3];
tab3
[
1
]
=
5
;
console
.
log
(
tab3
,
tab4
);
// exercice7
function
deb7
(
x
:
number
,
y
:
number
):
number
{
let
val
=
0
;
for
(
let
i
=
0
;
i
<
y
;
i
++
)
{
val
+=
x
;
}
return
val
;
}
console
.
log
(
deb7
(
5
,
3
));
// exercice8.ts
function
deb8
(
n
:
number
):
number
{
if
(
n
===
0
)
{
return
1
;
}
return
n
*
deb8
(
n
-
1
);
}
console
.
log
(
deb8
(
5
));
\ No newline at end of file
This diff is collapsed.
Click to expand it.
qualdev/compte_rendu.txt
+
12
−
1
View file @
dc20534e
...
...
@@ -190,4 +190,15 @@ Règle fondamentale :
Toujours faire un git pull avant de faire un git push.
Toujours commiter vos modifications avant de faire un git pull.
La séquence idéale est : commit → pull → push.
\ No newline at end of file
La séquence idéale est : commit → pull → push.
TD 3
Débug:
Arrêt du programme : Le programme s'interrompt à l'endroit défini, permettant d'inspecter la mémoire et les variables.
Suivi des variables : L'exécution pas à pas permet de vérifier l'évolution des valeurs et de détecter d'éventuelles erreurs.
Portée des variables : Des variables du même nom peuvent exister dans des contextes différents, ce qui est observable avec le débogueur.
\ No newline at end of file
This diff is collapsed.
Click to expand it.
qualdev/td exeption.ts/td_exeption.ts
0 → 100644
+
92
−
0
View file @
dc20534e
//ex1
function
creeInitiales
(
nom
:
string
,
prenom
:
string
):
string
{
if
(
!
nom
&&
!
prenom
)
throw
new
VideError
(
"
Le nom et le prénom ne peuvent pas être vides.
"
);
if
(
!
nom
)
throw
new
VideError
(
"
Le nom ne peut pas être vide.
"
);
if
(
!
prenom
)
throw
new
VideError
(
"
Le prénom ne peut pas être vide.
"
);
return
nom
[
0
].
toUpperCase
()
+
prenom
[
0
].
toUpperCase
();
}
class
VideError
extends
Error
{
constructor
(
message
:
string
)
{
super
(
message
);
this
.
name
=
"
VideError
"
;
}
}
console
.
log
(
"
Boguet
"
,
"
Thomas
"
)
console
.
log
(
""
,
"
Thomas
"
)
//ex2
class
Etudiant
{
INE
:
string
;
nom
:
string
;
prenom
:
string
;
constructor
(
INE
:
string
,
nom
:
string
,
prenom
:
string
)
{
this
.
INE
=
INE
;
this
.
nom
=
nom
;
this
.
prenom
=
prenom
;
}
setINE
(
INE
:
string
):
void
{
if
(
INE
.
length
!=
11
)
{
throw
new
Error
(
"
Format incorrect
"
);
}
for
(
let
i
=
0
;
i
<
tab
.
length
;
i
++
)
{
if
(
INE
)
}
this
.
INE
=
INE
;
}
}
let
etudiant
=
new
Etudiant
(
"
1234567890A
"
,
"
Dupont
"
,
"
Jean
"
);
try
{
etudiant
.
setINE
(
"
1234567890AB
"
);
}
catch
(
e
)
{
console
.
log
(
e
.
message
);
}
// ex 3
function
datedef
(
date
:
string
):
number
[]
{
let
tab
=
date
.
split
(
"
/
"
);
let
jour
=
Number
(
date
[
0
]);
let
mois
=
Number
(
date
[
1
]);
let
ann
=
Number
(
date
[
2
]);
return
[
jour
,
mois
,
ann
];
}
let
date
=
"
22/05/1994
"
;
//Ex 4
function
calcule
(
tableau
:
Array
<
number
>
,
indice
:
number
,
operateur
:
string
,
operande
:
number
):
number
{
switch
(
operateur
)
{
case
"
+
"
:
return
tableau
[
indice
]
+
operande
;
case
"
-
"
:
return
tableau
[
indice
]
-
operande
;
case
"
*
"
:
return
tableau
[
indice
]
*
operande
;
case
"
/
"
:
return
tableau
[
indice
]
/
operande
;
}
return
0
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment