Hello everyone!

I am new to these forums. I come here today because I need help with a C++ programming assignment for school, and in the long term I also hope to find some mentors and friends here. I hope to revisit these forums many times to come both to get help and offer help to others as I become a proficient programmer.

So! Here is the assignment! I need to make a C++ program that will try to guess what number I am thinking of. It's sort of like that old magic trick where the magician asks "is this your card?"

The program will prompt the user to think of a number between 1 and 100. The program will then print out a number and ask the user to either confirm the number as the correct number (the number the user thought of), or in case the number is wrong, the user will tell the program that the number is either lower or higher than the displayed number. The program will continue guessing until the correct number is found, at which point the user will tell the program that the number is correct and the program will print out message celebrating its success at guessing the number. One important requirement is that the program may not use any more than 7 guesses to find the number.

(By the way, do you say "program will prompt" or "computer will prompt"? Is it "user will tell the program" or "user will tell the computer"? Is it in any context important to make this kind of distinction between computer and program?)

Here is the skeleton code I got so far:

Code:
#include <iostream>

using namespace std;

int main()
{
    cout << "Think of a number between 1 and 100. Press ENTER when ready." << endl;

    cout << "Is it " << " ?" << endl;
    cout << "Press 1 and ENTER if the number is correct." << endl;
    cout << "Press 2 and ENTER if your number is lower." << endl;
    cout << "Press 3 and ENTER if your number is higher." << endl;

    cout << "Found it!" << endl;

    return 0;
}
I know it's not much right now. But at least I got some text on the screen. It's a start! It also outlines how the program is supposed to work. I also know how to store the user returned value and store it in a variable. But I don't know how to build the logic or the algorithm for this.

Where do I go from here? I know those three prompts will have to iterate until the correct number is found. So do I use a while loop in here?

The last printout will have to display at the end of the program, and only after the correct number is found. So do I use an else condition here?

I read on the web that an algorithm called binary search is perfect for this situation. I also read that C++ has some built in functionality for this in the standard library. But my problem is that I have no idea how to implement this. I am completely green to both C++ and programming in general! I have read some tutorials, watched some tutorials, and I understand some of the fundamental concepts of programming. But I have no idea how to do something like binary search.

The course I'm in is a beginner's course, and I don't understand how they expect us to know this kind of stuff. We haven't even learned yet how to do inclusions, library imports or how header files work and all that stuff. The course book is mediocre at best. So please Internet, can you help me? You don't have to give me a complete solution, but maybe you can give me some pointers (no pun intended) so I can finish this on my own?