Advertisement
Guest User

Untitled

a guest
Oct 15th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.68 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3. #include <ctime>
  4.  
  5.  
  6. using namespace std;
  7.  
  8.  
  9.  
  10. int main(){
  11.     int n, k, a1 = 0, a2 = 0, a3 = 0, a4 = 0, a5 = 0, a6 = 0, a7 = 0, a8 = 0, a9 = 0, a10 = 0, a11 = 0, a12 = 0;
  12.    
  13.     srand(time(NULL));
  14.  
  15.     cout << "Add meg hanyoldalu legyen a dobo kockad. 2 es 12 kozott: ";
  16.     cin >> n;
  17.     cout << "Add meg hanyszor szeretnel dobni(maximum 1000): ";
  18.     cin >> k;
  19.     int t[1000];
  20.    
  21.     char m [11] [1000];
  22.     for (int i = 0; i <= k; i++)
  23.     {
  24.         int veletlen = rand() % n + 1;
  25.         t[i] = veletlen;
  26.     }
  27.     for (int i = 0; i < k; i++)
  28.     {
  29.         cout << t[i] << ",";
  30.     }
  31.  
  32.     for (int i = 0; i < k; i++)
  33.     {
  34.         if (t[i] == 1){
  35.        
  36.             m[0][a1] = char(219);
  37.             a1++;
  38.            
  39.         }
  40.         else if (t[i] == 2){
  41.             m[1][a2] = char(219);
  42.             a2++;
  43.            
  44.         }
  45.         else if (t[i] == 3){
  46.             m[2][a3] = char(219);
  47.             a3++;
  48.            
  49.         }
  50.         else if (t[i] == 4){
  51.             m[3][a4] = char(219);
  52.             a4++;
  53.            
  54.         }
  55.  
  56.         else if (t[i] == 5){
  57.             m[4][a5] = char(219);
  58.             a5++;
  59.            
  60.         }
  61.         else if (t[i] == 6){
  62.             m[5][a6] = char(219);
  63.             a6++;
  64.            
  65.         }
  66.         else if (t[i] == 7){
  67.             m[6][a7] = char(219);
  68.             a7++;
  69.            
  70.         }
  71.         else if (t[i] == 8){
  72.             m[7][a8] = char(219);
  73.             a8++;
  74.            
  75.         }
  76.         else if (t[i] == 9){
  77.             m[8][a9] = char(219);
  78.             a9++;
  79.            
  80.         }
  81.         else if (t[i] == 10){
  82.             m[9][a10] = char(219);
  83.             a10++;
  84.            
  85.         }
  86.         else if (t[i] == 11){
  87.             m[10][a11] = char(219);
  88.             a11++;
  89.            
  90.         }
  91.         else if (t[i] == 12){
  92.             m[11][a12] = char(219);
  93.             a12++;
  94.            
  95.  
  96.         }
  97.        
  98.        
  99.     }
  100.     cout << endl;
  101.  
  102.     for (int i = 0; i < n; i++)
  103.     {
  104.        
  105.         cout << i+1 << "szam "<<"\t";
  106.         for (int h = 0; h < k; h++)
  107.         {
  108.             cout  << m[i][h];
  109.         }
  110.         cout << endl;
  111.     }
  112.    
  113.  
  114.  
  115.  
  116.     system("pause");
  117.     return EXIT_SUCCESS;
  118.  
  119. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement