............................

Yes.
Can someone write a sample program that guesses a magic number from 1-50?

Yes.
Don't you mean 'will someone...'
1
2
3
4
5
6
7
8
9
10
11
int magic_number()
{
    return 9;
}

int main()
{
    for (int i = 1; i <= 50: i++)
        if (i == magic_number())
            break;
}
Last edited on
[Removed because the OP trashed the original question]
Last edited on
It's nearly Friday:
https://en.wikipedia.org/wiki/42_(number)

How has this thread attracted 6 answers (so far)?
Last edited on
I think he said the code was doing the guessing.
1
2
3
4
5
6
7
8
9
bool done{};
int guess{1};
char in{};
do
{
  cout << "is it " guess++ << "?\n";
  cin >> in;
  done = ((in=='y') || (in == 'Y'));
}while(!done && guess < 51);
Last edited on
Who was the OP? Or did he get REPORTED?
Don't remember, don't care. An acute attack of CRS happened.

And yes.

Why? Looking at Grey's edit probably because the OP edited their post to make a spam advert push.
When I edited my post, the OP had edited his posts to just have a number 1...wasn't spam but I guess someone doesn't like this sort of activity.
Thanks for the update, Grey.

I did say "probably." :Þ

Well, good riddance to stinky rubbish.....
Registered users can post here. Sign in or register to post.