Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Algorithmie
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
mathias.catala
Algorithmie
Commits
bac6e98b
Commit
bac6e98b
authored
1 year ago
by
mathias.catala
Browse files
Options
Downloads
Patches
Plain Diff
"update"
parent
642ec133
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
bancomat.scala
+142
-0
142 additions, 0 deletions
bancomat.scala
myTP/exos/dilatation.c
+2
-1
2 additions, 1 deletion
myTP/exos/dilatation.c
myTP/exos/exo1
+0
-0
0 additions, 0 deletions
myTP/exos/exo1
myTP/exos/exo1.c
+11
-1
11 additions, 1 deletion
myTP/exos/exo1.c
with
155 additions
and
2 deletions
bancomat.scala
0 → 100644
+
142
−
0
View file @
bac6e98b
import
scala.io.StdIn._
object
Main
{
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
var
pincorrect
=
"INTRO1234"
var
pin
=
""
var
continuer
=
true
var
montantinitial
=
1200.0
var
tentative
=
0
var
choixdevise1
=
"CHF"
var
choixdevise2
=
"EUR"
var
choix
=
0
var
depot
=
0
var
choix1
=
depot
var
consultation
=
0
var
choix2
=
consultation
var
montantdeposer
=
0
var
devise
=
0
var
retrait
=
0
var
choix3
=
retrait
var
montantderetrait
=
""
var
geossecoupures
=
0
var
petitesecoupures
=
0
var
coupures
=
0
var
montantderetraitEuro
=
0
var
montantautoriser
=
1080
var
montantautoriserEuro
=
0
var
montantdisponible
=
montantinitial
while
(
continuer
)
{
//afficher les operation
println
(
"Choisissez votre opération:"
)
println
(
"1. Dépôt"
)
println
(
"2. Consultation"
)
println
(
"3. Retrait"
)
println
(
"4. Terminer"
)
println
(
"Entrez le numéro de l'opération: "
)
choix
=
readLine
().
toInt
if
(
choix
==
1
||
choix
==
2
||
choix
==
3
||
choix
==
4
){
continuer
=
false
}
if
(
choix
==
4
){
println
(
"Fin des opérations.n'oubliez pas de récupérer votre carte."
)
}
if
(
choix
==
1
||
choix
==
2
||
choix
==
3
){
//demander a l'utilisateu le pin
println
(
"Saisissez votre code pin > "
)
pin
=
readLine
(
"quel est votre pin? >"
)
if
(
pin
==
pincorrect
){
//afficher les operation
//demander a l'utilisateu de choisir une operation
println
(
"Choisissez votre opération:"
)
println
(
"1. Dépôt"
)
println
(
"2. Consultation"
)
println
(
"3. Retrait"
)
println
(
"4. Terminer"
)
println
(
"Entrez le numéro de l'opération: "
)
choix
=
readLine
().
toInt
}
else
{
while
(
tentative
<
3
&&
pin
!=
pincorrect
)
{
println
(
"Il faut saisir un pin correct > "
)
pin
=
readLine
()
tentative
+=
1
}
}
if
(
tentative
==
3
&&
pin
!=
pincorrect
){
println
(
"Pour votre protection, les opérations bancaires vont s'interrompre, récupérez votre carte"
)
continuer
=
false
}
}
if
(
choix
==
1
){
continuer
=
true
while
(
continuer
){
println
(
"quelle est la devise: 1 pour CHF et 2 pour EUR? "
)
devise
=
readLine
().
toInt
if
(
devise
==
1
||
devise
==
2
){
println
(
"quelle est le montant a deposer?"
)
montantdeposer
=
readInt
()
if
(
montantdeposer
%
10
==
0
){
continuer
=
false
}
}
else
{
println
(
"Impossible"
)
}
if
(
devise
!=
1
||
devise
!=
2
||
montantdeposer
%
10
!=
0
)
{
println
(
"operation impossible"
)
}
if
(
devise
==
1
||
devise
==
2
){
if
(
devise
==
1
&&
montantdeposer
%
10
==
0
){
println
(
"operation reussie; "
+
"montantdisponible"
+
montantinitial
+
montantdeposer
)
}
}
else
{
println
(
"operation impossible"
)
}
if
(
devise
==
2
&&
montantdeposer
%
10
==
0
){
println
(
"montantdisponible "
+
montantinitial
+
0.95
*
montantdeposer
)
}
if
(
devise
!=
2
||
montantdeposer
%
10
!=
0
)
{
if
(
montantdeposer
%
10
!=
0
||
devise
!=
1
)
println
(
"operation impossible"
)
}
montantdisponible
=
montantinitial
+
montantdeposer
printf
(
"Votre depot a été pris en compte, le nouveau montant disponible sur votre compte est : %.2f CHF\n"
,
montantdisponible
)
}
}
if
(
choix
==
2
)
{
printf
(
"la valeur de montantdisponible : %.2f \n"
,
montantdisponible
)
}
}
if
(
choix
==
4
){
println
(
"Fin des opérations.n'oubliez pas de récupérer votre carte."
)
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
myTP/exos/dilatation.c
+
2
−
1
View file @
bac6e98b
...
...
@@ -72,6 +72,7 @@ int **init_array(int m, int n) {
}
int
main
()
{
int
m
=
5
,
n
=
5
;
int
**
tab
=
init_array
(
m
,
n
);
...
...
@@ -80,4 +81,4 @@ int main() {
int
**
res
=
dilatation
(
m
,
n
,
(
const
int
**
)
tab
);
print_tab
(
m
,
n
,
(
const
int
**
)
res
);
}
\ No newline at end of file
}
This diff is collapsed.
Click to expand it.
myTP/exos/exo1
+
0
−
0
View file @
bac6e98b
No preview for this file type
This diff is collapsed.
Click to expand it.
myTP/exos/exo1.c
+
11
−
1
View file @
bac6e98b
...
...
@@ -12,6 +12,7 @@ bool palindrome(int n ,char* mot);
void
swap
(
int
*
a
,
int
*
b
);
void
bubbleSort
(
int
n
,
int
tab
[]);
void
insertionSort
(
int
n
,
int
tab
[]);
bool
palindrome2
(
int
n
,
char
*
mot
);
int
main
(){
int
i
;
...
...
@@ -36,7 +37,7 @@ int main(){
//printf("%u ",factoriel(4));
//perfect(0);
//
palindrome
(0
,"kaya
df
k");
printf
(
"Le mot est :%d"
,
palindrome
2
(
5
,
"kayak"
)
)
;
}
...
...
@@ -91,6 +92,15 @@ int perfect(int num){
}
}
bool
palindrome2
(
int
n
,
char
*
mot
){
if
(
n
<=
2
){
return
mot
[
0
]
==
mot
[
n
-
1
];
}
else
{
return
(
mot
[
0
]
==
mot
[
n
-
1
])
&&
palindrome2
(
n
-
2
,
mot
+
1
);
}
}
bool
palindrome
(
int
n
,
char
*
mot
){
int
len
=
strlen
(
mot
)
-
(
n
+
1
);
...
...
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