Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <conio.h>
- #include <stdlib.h>
- #include <cstring>
- bool check(int ac, char* av[]);
- int main(int argc, char* argv[]) {
- check(argc, argv);
- getchar();
- return 0;
- }
- bool check(int ac, char* av[]) {
- if (ac < 3) {
- printf("Too few arguments");
- return false;
- }
- else if (ac > 3) {
- printf("Too many arugments");
- return false;
- }
- else if (!strcmp(av[1], "numbers.txt") && !strcmp(av[2], "-n")) {
- printf("Sorting numbers from numbers.txt");
- return true;
- }
- else if (!strcmp(av[1], "strings.txt") && !strcmp(av[2], "-s")) {
- printf("Sorting strings from strings.txt");
- return true;
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement