Primitivisme

Loterie espagnole La primitiva (6 из 49 + 1 de 10)

Ci-dessous une démonstration des outils de programmation, pris en charge dans LCRYP:

 
/* Variables globales. */
int ga;
double gx;
char gc;

int OnTick()
{
  /* Variables locales. * /
  int a, indice;
  double X,et;
  char c;

  /* Affectation en tant qu'opération. * /
  ga = a = 3;
  gx = x = y = 5;
  gc = c = '0';

  index = 0;
  prt(indice,"a = [");
  /* Цикл pendant. */
  tandis que(une>= 0) {
    prt_a(indice,une);
    a = a - 1;
  }
  prt_a(indice,"]");

  index = 1;
  Print_AZ(indice); // Utilisation de la fonction.

  index = 2;
  gc = 'A';
  prt(indice,"");
  /* Цикл do-while. */
  faire {
     prt_a(indice,gc);
     gc = gc + 1;
  } tandis que(gc != 'F');

  /* Démonstration de récursivité. */
  index = 2;
  prt(indice,"");
  x = 3;
  y = 2;
  gx = factr(indice,math(X,et)); // Utilisation des arguments de fonction.
  prt_a(indice," factr =");
  prt_a(indice,gx);

  revenir 0;
}

/* Affichage de l'alphabet anglais. */
int Print_AZ(index int)
{
  char ch;
  prt(indice,"");  // Le début de la sortie de la ligne avec l'index d'index sur le graphique.
  /* цикл pour */
  pour (ch = 'A'; ch<= 'Z'; ch = ch + 1) {
    prt_a(indice,ch); // Continuer d'afficher la ligne avec l'index d'index du graphique.
  }
  revenir 0;
}

/* Renvoie la factorielle du nombre i. */
int factr(index int, int i)
{
  prt_a(indice,je);
  si(je<2) {
    revenir 1;
  }
  autre {
     retourne je * factr(indice,i-1);
  }
}

maths int(int a, int b)
{
  retourne a + b;
}

/* Fonction non activée. */
int OnInit()
{
  revenir;
}

/* Fonction non activée. */
int OnBar()
{
  revenir;
}

Évaluer l'article