Advertisement
Guest User

Untitled

a guest
Oct 17th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.64 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Test_1
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int mise, nbtirage =1, gain =0,gaininstant=0;
  14. Random alea = new Random();
  15. string saisie="";
  16. mise = 1;
  17. int n1 = 0;
  18. while (mise !=0)
  19. {
  20. Console.WriteLine("****************Mise numéro " + nbtirage + " ****************");
  21. Console.WriteLine("Saisir le montant de votre mise (0 pour arrêter)");
  22. saisie = Console.ReadLine();
  23. mise = Convert.ToInt32(saisie);
  24. n1 = alea.Next() % 10; ;
  25. Console.WriteLine("Tirage: "+n1);
  26. if (n1==7)
  27. {
  28. if(mise==0)
  29. {
  30. Console.WriteLine("Fin de partie !");
  31. }
  32. else
  33. {
  34. gaininstant = mise * 3;
  35. gain = gain + gaininstant;
  36. }
  37. }
  38. else
  39. {
  40. gain = gain - mise;
  41. }
  42. nbtirage++;
  43.  
  44. }
  45. if (gain <= 0)
  46. {
  47. Console.WriteLine("Désolé !! Vous perdez " + -gain + " euros !!");
  48. }
  49. else
  50. {
  51. Console.WriteLine("Bravo !! Vous gagnez " + gain + " euros !!");
  52. }
  53. Console.ReadKey();
  54. }
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement