Skip to content

Instantly share code, notes, and snippets.

@kiroma
Created September 19, 2018 12:29
Show Gist options
  • Save kiroma/efb74a20ea02b95ba43f0256e6090e32 to your computer and use it in GitHub Desktop.
Save kiroma/efb74a20ea02b95ba43f0256e6090e32 to your computer and use it in GitHub Desktop.
KookyFlakyHexadecimal created by kiroma - https://repl.it/@kiroma/KookyFlakyHexadecimal
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
int main(int argc, char** argv) {
std::vector<int> numbers;
int input;
std::fstream ifs(argv[1], std::ios::in);
while(ifs >> input)numbers.push_back(input);
if(atoi(argv[2]) > numbers.size()) std::cerr << "Error";
std::sort(numbers.begin(), numbers.end());
std::cout << numbers[numbers.size()-atoi(argv[2])];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment