Facebook
From wojtek, 5 Months ago, written in Plain Text.
This paste is a reply to x from wojtek - view diff
Embed
Download Paste or View Raw
Hits: 86
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4. int number, sum, previousnumber, wynik, i = 0;
  5. int main()
  6. {
  7.     srand( time( NULL ) );
  8.     do
  9.     {
  10.         previousnumber = number;
  11.         number = (std::rand() % 50 ) + 2 ;
  12.         sum = sum + number;
  13.         std::cout << number << std::endl;
  14.  
  15.          if(previousnumber < number){
  16.             wynik = number;
  17.          }
  18.         i++;
  19.     }while(number%7 != 0);
  20.         std:: cout << "The biggest generated number is equal: " << wynik << std::endl;
  21.         std::cout << "Sum of all generated numbers is equal: " << sum << std::endl;
  22.         std::cout << "Quantity of generated numbers is equal: " << i << std::endl;
  23.  
  24.     return 0;
  25. }
  26.