Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <sstream>
- #include <queue>
- using namespace std;
- //1 2 3 4 8 0 19 328 11 3222
- struct namber {
- int nam;
- };
- int main() {
- queue<namber> students_info;
- int a=4;
- cout << "A: ";
- cin >> a;
- int b=20;
- cout << "B: ";
- cin >> b;
- queue<namber> t1;
- queue<namber> t2;
- queue<namber> t3;
- ifstream info("..\\tess.txt");
- string line;
- namber tt;
- stringstream ss;
- while (getline(info, line)) {
- ss << line;
- ss >> tt.nam;
- if (tt.nam <= a) {
- t1.push(tt);
- } else if (tt.nam > a && tt.nam <= b) {
- t2.push(tt);
- } else {
- t3.push(tt);
- }
- ss.clear();
- }
- while (!t1.empty()) {
- cout << t1.front().nam << " ";
- t1.pop();
- }
- while (!t2.empty()) {
- cout << t2.front().nam << " ";
- t2.pop();
- }
- while (!t3.empty()) {
- cout << t3.front().nam << " ";
- t3.pop();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment