Untitled

mail@pastecode.io avatar
unknown
c_cpp
a year ago
772 B
2
Indexable
Never
#include <iostream>
#include <queue>
using namespace std;
int main() {
    queue <string> studentNames;
    queue <float> studentGrades;
    queue <string> topStudents;
    string names;
    float grades;
    cout<<"Enter names: ";
    for (int i = 0 ; i < 3; i++) {
        cout<< "Enter name of student " << i+1<<" : "<<endl;
        cin >> names;
        cout<< "Enter grade of student " << i+1<<" : "<<endl;
        cin>>grades;
        studentNames.push(names);
        studentGrades.push(grades);
    }

    for (int i = 0 ; i < studentNames.size(); i++){
        if (studentGrades.front()> 70){
            cout<< studentNames.front()<<endl;
        }
        studentNames.pop();
        studentGrades.pop();

    }


    return 0;
}