Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <fstream>
- #include <iostream>
- #include <string>
- #include <vector>
- int main(int argc, char *argv[])
- {
- std::ifstream stream(argv[1]);
- std::string line;
- std::vector<int> quantity_of_numbers(1000, 0);
- int number_count;
- while (getline(stream, line))
- {
- int number_to_sort = std::stoi(line);
- quantity_of_numbers[number_to_sort]++;
- }
- for (int i = 0 ; i < (quantity_of_numbers.capacity()) ; ++i)
- {
- number_count = quantity_of_numbers[i];
- for (int j = 0; j < number_count; ++j)
- {
- std::cout << i << std::endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement