Advertisement
Guest User

Untitled

a guest
Feb 18th, 2020
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. void assign_remainder(int& first, int& second) {
  2.     if (first > second) {
  3.         first %= second;
  4.     }
  5.     else {
  6.         second %= first;
  7.     }
  8. }
  9.  
  10. void assign_remainder(int* first, int* second) {
  11.     if (*first > *second) {
  12.         *first = *first % *second;
  13.     }
  14.     else {
  15.         *second = *second % *first;
  16.     }
  17. }
  18.  
  19. void round_1(float& ch) {
  20.     if (int(ch * 10) % 10 >= 5) {
  21.         ch = int(ch) + 1;
  22.     }
  23.     else {
  24.         ch = int(ch);
  25.     }
  26. }
  27.  
  28. void round_1(float* ch) {
  29.     if (int(*ch * 10) % 10 >= 5) {
  30.         *ch = int(*ch) + 1;
  31.     }
  32.     else {
  33.         *ch = int(*ch);
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement