[Solved] C++ code not compiled correctly [closed]


First things first,

cin << AmerAge;

should be:

cin >> AmerAge;

I remember this with the memory aid: you input data to the variable, cin >> var, you output it from it, cout << var.


Secondly, conio is not a C++ header, it’s not even a C header.

It’s a blast from the past from Borland (or Invogue or Enchilada or whatever they call themselves nowadays).

And it has no place outside assignments in Indian educational institutions, where they seem to favour it despite having much more modern (and free and standards-compliant) options. It also doesn’t complain about evils like not specifying a return type from main().


Finally, you may want to go back and reread all those warnings you should have heeded when installing MinGW.

You know, the ones about installing into a path with spaces in it and how that’s likely to screw up a large chunk of the toolchain 🙂

solved C++ code not compiled correctly [closed]