In my code below, if you enter an incorrect age, it starts the program over.. After you enter a correct input, it will output your name and age, then it will show your name and age = 0... Whatever the age is set to in the private class is what it outputs. Any ideas?
a) main must return an int. void is non standard and considered bad code
b) dont use usingnamespace std; or with any namespace for that matter. instead use an explicit qualifier (ie std::cout)
c) i would suggest better names for your variables. they should express what you mean. i have no idea what mystring might do.
d) you can't call main, and you shouldnt. idk why you would even need to. just put it in a loop until it is correct
e) your else bracket is off. it looks like its closing student1
f) system is evil. never use it. ever
g) whats up with the two prototypes up top? you dont use them, and you already have members for extracting that info. also, in c++ it isnt neccesary to qualify data types with struct
h) why are you including all of those libraries?
a) Okay, fixed that..
b) I have to use it, this is for my c++ class and it's part of the requirements for each program.
c) I meant to delete mystring before I posted this..
d) What kind of loop?
e) Fixed that.
f) Gotcha!
g) Meant to delete those also. Did I qualify something with struct?
h) Again, requirement for the class.
a) ok
b) i didnt say use the namespace called std. i said that specific line is bad
c) see a
d) while, do-while, for...
e) see c
f) good!
g) no. its just from c
h) you really have to include <algorithm>?