How to print this string selectively like print the details above the value which is repeating. I am not able to figure out the logic Please help me

Please check the Sort Game problem statement and help me.

hi @gunishmatta firstly you have not taken the input for “x”.
Secondly, dont take input for string via getline, because name and salary are present on the same line, so take input via cin.
For printing only the required names, you can place a check like :

if (employee[j] >= x) {
    cout << //print required things here
}
1 Like

Thanks for figuring out my silly mistake.

@gunishmatta dont forget to mark your doubt as resolved!