Created
September 19, 2018 12:29
-
-
Save kiroma/efb74a20ea02b95ba43f0256e6090e32 to your computer and use it in GitHub Desktop.
KookyFlakyHexadecimal created by kiroma - https://repl.it/@kiroma/KookyFlakyHexadecimal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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])]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 2 4 6 7 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment