Thread: First Post / Newb Help

  1. #1
    Registered User
    Join Date
    Mar 2005
    Posts
    6

    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++

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,934
    >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.
    Code:
    int main()
    {
    .
    .
    }
    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.

  3. #3
    Registered User
    Join Date
    Mar 2005
    Posts
    6
    Thank you

  4. #4
    email for MystWind avatar MystWind's Avatar
    Join Date
    Feb 2005
    Location
    Holland , The Hague
    Posts
    88
    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
    PLay MystWind beta , within two years

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help (Trying to post message)
    By mrkm in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 10-06-2003, 04:05 PM
  2. Post your Best Text Adventure
    By Joe100 in forum Game Programming
    Replies: 3
    Last Post: 08-15-2003, 05:47 PM
  3. Auto POST
    By vasanth in forum A Brief History of Cprogramming.com
    Replies: 10
    Last Post: 06-07-2003, 10:42 AM
  4. post update
    By iain in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 08-12-2001, 10:47 AM