Im sorry i didn't post my work I always get these kind |
Without space before the stars?
You really should post
your attempt. Then we can point out what is wrong in it and you will learn.
Can you explain what
ajh32's code does, exactly?
The compiler error messages -- are they from the code that you copy-pasted from
ajh32's post?
Do you notice a number in parentheses right after the filename in both messages? That is the linenumber. Helps you see where in the code the error appears to be. (IDE might point it in other ways too.)
You have one error. Identifier "n", a name, has been declared on line 9. That is ok. Then, later (line 21)
in same scope the same name is declared again. If there are two Johns in a room and someone calls John, who should answer?
ajh32's is legal C++, yet there was time when it was not. The C++ standard has been updated to allow that code. The old compiler's that have not been updated to support the new standard, can think the code erroneous.
What C++ compiler are you using? Some MS Visual, but which version?