Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdbool.h>
- #include <stdlib.h>
- #include <assert.h>
- struct Range {
- int low;
- int high;
- };
- typedef struct Range range;
- //input should be an int array with num empty cells
- //limits should be an array with the size num, while cell i has the range corresponding to the i-th input
- void input_numbers_within_range(int* input, int num, range* limits) {
- bool isInputOk = true;
- do {
- for(int i = 0,x; i < num; ++i) {
- scanf("%d",&x);
- if(!(limits[i].low <= x && x <= limits[i].high)) {
- printf("Input not in range\n");
- isInputOk = false;
- Type :qa! and press <Enter> to abandon all changes and exit Vim 1,18 Top
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement