diff --git a/bancomat.scala b/bancomat.scala new file mode 100644 index 0000000000000000000000000000000000000000..8c315d85656c7521d7dd8832e0c1ef124b3a287b --- /dev/null +++ b/bancomat.scala @@ -0,0 +1,142 @@ +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 diff --git a/myTP/exos/dilatation.c b/myTP/exos/dilatation.c index 69a127f2b08a2e31cab0317dd02bea3daa02812f..aadf6f6957c52d06a5a1415c8e08c9a6c900a287 100644 --- a/myTP/exos/dilatation.c +++ b/myTP/exos/dilatation.c @@ -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 +} diff --git a/myTP/exos/exo1 b/myTP/exos/exo1 index 6125d65986a2d944cc6a0868d30c3889337a0b9f..6c8901b29a22aabb87dd480bbb08a31c46808396 100755 Binary files a/myTP/exos/exo1 and b/myTP/exos/exo1 differ diff --git a/myTP/exos/exo1.c b/myTP/exos/exo1.c index 7d1f7069e40ea29050ebd3b4d59b721716a77600..3585a7951dfbd664fef7aed565ca6a87bc08cbdd 100644 --- a/myTP/exos/exo1.c +++ b/myTP/exos/exo1.c @@ -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,"kayadfk"); + printf("Le mot est :%d", palindrome2(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);