Advertisement
Guest User

code

a guest
Sep 23rd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. int RandNum(int firstNum, int secondNum, int thirdNum) {
  2. int initialRandInt = rand() % 10;
  3.  
  4. firstNum = initialRandInt;
  5. secondNum = initialRandInt;
  6. thirdNum = initialRandInt;
  7.  
  8. while ( secondNum == firstNum ) {
  9. secondNum = rand() % 10;
  10. }
  11. while ( thirdNum == firstNum || thirdNum == secondNum ) {
  12. thirdNum = rand() % 10;
  13. }
  14. return firstNum, secondNum, thirdNum;
  15. }
  16.  
  17. int firstNum;
  18. int secondNum;
  19. int thirdNum;
  20.  
  21. RandNum(firstNum, secondNum, thirdNum);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement