Looks good.
A couple extra things to consider if you want. First, I prefer to start with a completely empty file. I don't like that Dev-C++ starts you off with non-standard code, but I also think its better to just understand what you need and put it in when you need it. For example, you don't need <stdlib.h> in that program. You do need <iostream> for cout and cin, and you do need <string> for the string class. If you understand that, then for the next program you write you can decide which you need and only use those.
A second thing is to work on your indenting (unless the forum software messed it up). Each time you add a new scope (basically in between your braces for the main function and the ifs and else ifs) you should indent the code four more spaces than the previous line. When the scope ends at the closing brace, go back to the previous indentation level. For example:Code:if ( age <= 12 && age > 0) { cout<<"You are a child!\n"; }



LinkBack URL
About LinkBacks


