9
u/Aleksey259 Jul 26 '21
I think that's because of the way you wrote that smile. Do :) not (: and everything will be alright
4
3
u/Kevin-Mancuso Jul 26 '21
Mainly this IDE… 👀 I strongly suggest VisualStudio if you have to work on big projects, or else get Studio Code, which is lightweight and awesome also for other languages. Also you are trying to return a string in INT function, and further more, you are trying to print message, referencing it before assignment (line 29)
1
1
13
u/marko312 Jul 26 '21
Also note:
messageshould not be used inmain, it is defined in the other functionthe smiley is written in a non-standard direction
12
2
u/bbqranchman Jul 26 '21
Since serious answers have been given already...
Your problem is you're using light theme in your editor
2
u/Wiimmoz Jul 26 '21
The only way I can get dark mode is to use a magnifier and invert the colours. I'm using Code Blocks btw.
1
u/bbqranchman Jul 26 '21
I'm not familiar with Code Blocks! Is there a particular reason you prefer using it over visual studio?
4
1
u/Shreyas_Gavhalkar Jul 26 '21
I'll walk you through here, 1st as everyone pointed out that the return type of the the function should be string. Also in main() you should give a variable a value by calling the function. What I am trying to say is declare another string named message in main() and use message=getsecretNum(secretNum) instead of cout since the function you are calling is returning a value you will need to store it first. Then you can keep the cout<<message in main and it'll work fine. Also, dark mode...
1
1
u/JellySword8 Jul 26 '21
Not gonna try to answer OP's question as I can see that it's already been answered by multiple people (and I'm probably not experienced enough to give the right answer anyway) so instead here's my own question: Wouldn't it make more sense to use if else rather then a switch statement?
2
2
Jul 26 '21
You claim to return an int while actually returning a std::string, change the int to std::string.
19
u/eightball01 Jul 26 '21
getsecretNum()'s return type is int, should be string given how you're using it. Also, you might want to initialize message to "" or you'll likely get another error upon fixing the first.