Advertisement
Guest User

lotto.c

a guest
Oct 11th, 2010
375
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.87 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5. int input;
  6.  
  7. int checkduplicate(int array[]){
  8.     return 0;
  9. }
  10.  
  11. int lotterytype(int type){
  12.     switch(type) {
  13.         default:
  14.             break;
  15.         case 5:
  16.             return 90;
  17.             break;
  18.         case 6:
  19.             return 45;
  20.             break;
  21.     }
  22.     return 0;
  23. }
  24.  
  25. int generate(int lotto) {
  26.     int i=1;
  27.     int szamok[input];
  28.     srand ( time(NULL) );
  29.     szamok[0] = rand()  % lotterytype(input) + 1;
  30.     while (i<=input) {
  31.         szamok[i] = rand()  % lotterytype(input) + 1;
  32.         printf("%d\n", szamok[i]);
  33.         i++;
  34.     }
  35.     /*int z=0;
  36.     while (z<=input-1) {
  37.         printf("%d\n", szamok[z]);
  38.         z++;
  39.     }*/
  40.     return 0;
  41. }
  42.  
  43. int main() {
  44.     printf("Milyen lottót szeretnél játszani?\n");
  45.     scanf("%d", &input);
  46.     while (input!=5 && input!=6) {
  47.         printf("Csak 5-ös/6-os lottó választható!\n");
  48.         scanf("%d", &input);
  49.     }
  50.     printf("\n");
  51.     generate(lotterytype(input));
  52.     return 0;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement