Ledger Nano X - The secure hardware wallet
SHARE
TWEET

Untitled

a guest Mar 31st, 2020 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   1 #include <stdio.h>
  2.   2 #include <stdbool.h>
  3.   3 #include <stdlib.h>
  4.   4 #include <assert.h>
  5.   5
  6.   6 struct Range {
  7.   7         int low;
  8.   8         int high;
  9.   9 };
  10.  10
  11.  11 typedef struct Range range;
  12.  12
  13.  13 //input should be an int array with num empty cells
  14.  14 //limits should be an array with the size num, while cell i has the range corresponding to the i    -th input
  15.  15
  16.  16 void input_numbers_within_range(int* input, int num, range* limits) {
  17.  17         bool isInputOk = true;
  18.  18         do {
  19.  19                 for(int i = 0,x; i < num; ++i) {
  20.  20                         scanf("%d",&x);
  21.  21                         if(!(limits[i].low <= x && x <= limits[i].high)) {
  22.  22                                 printf("Input not in range\n");
  23.  23                                 isInputOk = false;
  24.                                                                                   1,18          Top
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top