Advertisement
Guest User

Untitled

a guest
May 20th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 2.39 KB | None | 0 0
  1.  
  2.  
  3. import "Ct.dart";
  4. import 'dart:math';
  5. import "dart:io" ;
  6.  
  7. void main() {
  8. Random r = new Random(); //variavel Random
  9. var retorno;   //variavel do readLineSync
  10.  
  11.   Time time1 = Time();
  12.   time1.nome = "Flamengo";
  13.   time1.pontos = 0;
  14.   time1.placar = r.nextInt(6);
  15.  
  16.  
  17.   Time time2 = Time();
  18.   time2.nome = "Bahia";
  19.   time2.pontos = 0;
  20.   time2.placar = r.nextInt(3);
  21.  
  22.   Time time3 = Time();
  23.   time3.nome = "Santos";
  24.   time3.pontos = 0;
  25.   time3.placar = r.nextInt(4);
  26.  
  27.   Time time4 = Time();
  28.   time4.nome = "Gremio";
  29.   time4.pontos = 0;
  30.   time4.placar = r.nextInt(4);
  31.  
  32.   Time time5 = Time();
  33.   time5.nome = "Cruzeiro";
  34.   time5.pontos = 0;
  35.   time5.placar = r.nextInt(4);
  36.  
  37.   Time time6 = Time();
  38.   time6.nome = "Athelico PR";
  39.   time6.pontos = 0;
  40.   time6.placar = r.nextInt(4);
  41.  
  42.  
  43.  
  44.  
  45.   List<Time> tp = [time1, time2,time3, time4, time5, time6];
  46.   Time t1 = tp.removeAt(r.nextInt(tp.length));
  47.   Time t2 = tp.removeAt(r.nextInt(tp.length));
  48.   Time t3 = tp.removeAt(r.nextInt(tp.length));
  49.   Time t4 = tp.removeAt(r.nextInt(tp.length));
  50.  
  51.   Time f1;
  52.   Time f2;
  53.  
  54.  retorno = stdin.readLineSync(); // Aperta uma tecla para prosseguir
  55.  
  56.   print("Times participantes ${t1.nome} , ${t2.nome} , ${t3.nome} ${t4.nome}");
  57.  
  58.  
  59.  
  60.    print("${t1.nome} ${t1.placar} x ${t2.placar} ${t2.nome}");
  61.    if (t1.placar > t2.placar) {
  62.       print("${t1.nome} Classificado");
  63.       f1 = t1;
  64.    } else {
  65.      t1.placar < t2.placar;
  66.       print("${t2.nome} Classificado");
  67.       f1 = t2;
  68.    }
  69.  
  70.  
  71.   retorno = stdin.readLineSync();
  72.  
  73. print("${t3.nome} ${t3.placar} x ${t4.placar} ${t4.nome}");
  74.    if (t3.placar > t4.placar) {
  75.       print("${t3.nome} Classificado");
  76.       f2 = t3;
  77.    } else {
  78.      t3.placar < t4.placar;
  79.       print("${t4.nome} Classificado");
  80.       f2 = t4;
  81.    }
  82.  
  83.   retorno = stdin.readLineSync();
  84.  
  85. //final
  86.   print("${f1.nome} ${f1.placar} x ${f2.placar} ${f2.nome}");
  87.   if ( f1.placar > f2.placar) {
  88.     print("${f1.nome} Campeão!!");
  89.   } else {
  90.     f1.placar < f2.placar;
  91.   print("${f2.nome} Campeão ");
  92.   }
  93.  
  94.  
  95.  
  96. }
  97.   //print(t1.nome);
  98.  
  99.  // print("Times Cadastrados ${tp}");
  100.   // como imprimir todos os times sem ter que declarar 1 por um?
  101.   // print(time1.nome);
  102.   // print(time2.nome);
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  //print(time1.pontos);
  110.  //time1.vitoria();
  111.  //print(time1.pontos);
  112.  // time1.vitoria();
  113.  // print(time1.pontos);
  114.  
  115.   //time2.dormir();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement