dimanche 16 mai 2021

The output is freezing when the if condition is hitted

when the if condition is hitted the program is freezing by the way this is a part of the problem

the output is

1 poping
2 poping
3 poping
4 poping

when the if condition is hitted here the program is freezing

I am a new bee to programing and facing these issues

 #include <iostream>
    #include <queue>
    using namespace std;
    
    int main()
    {
        int k = 8;
        queue<int> q;
        while (k != 0)
        {
            int u;
            cin >> u;
            q.push(u);
            k--;
        }
        int b = 0;
        while (!q.empty())
        {
            
            
            if (q.front() == 5)
            {
                b++;
            }
             q.pop();
        }
        cout << b;
        return 0;
    }

Aucun commentaire:

Enregistrer un commentaire