I'm learning c++ at my university. the problem is it is a "Try Another Y/N" but, whenever I chose option No the program still loops. What seems to be the problem?
you must not call main recursively (call main from inside main).
put the while loop around all the code you want to repeat, and get rid of that.
main is 'special' and has a few rules that make it different from every other function you write.
among those are
- its parameters come from the OS, so you can call the program with arguments and read them.
- it returns a code to the OS, not another part of the program
- it cannot be called recursively (there does not seem to be a technical limitation but the language forbids it when using strict compiler settings)
- nothing you can see calls main, its the 'starting point' of the program.
code tags help us read posts. use <> on the side editor or [] style (code and /code)
warnings and strict compiler settings would have told you what I said.