-
First Post / Newb Help
Ok i am following one of this sites tutorials and i have come across a problem. I retyped some of the tutorials code to try and it did not work. I also copied there code exactly and came up with the same error. Can someone please tell me what is wrong with my code
Code:
# include <iostream>
using namespace std;
int main()
{
int age;
cout<<"Enter Age";
cin>> age;
cin.ignore();
if ( age < 30 ) {
cout<<" Yo be Young un Thrice Style /n";
}
else if ( age == 100 ) {
cout<<" You have hairy nipples /n";
}
else {
cout<<"You are fat /n";
}
cin.get();
}
I just solved my problem i had 2 code files in the same project and the main () was messing with each other. But i still have a question Why does it say Warning No newline at end of file. Is this bad? Thank you I am using Dev C++
-
>Why does it say Warning No newline at end of file. Is this bad?
I believe the Standard mandates that each line of code should end with a newline. So you probably have a right brace (}) as the last line in your source file, but no newline.
Basically just add a blank line at the end of your source file, which ensures your last line ends with a newline, if you want to conform with the Standard. ;)
-
-
I looked it up -- on one forum it says it advoids crashing.. didn't know that , I use dev too , if you don't have a newline it works just fine but now I know this I beter input a new line :D