Thread: newbie question ( can't resist ? hehe )

  1. #1
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765

    newbie question ( can't resist ? hehe )

    Yes, i've only been messing with C / C++ for around 2 weeks now. Out of fun. I did get familiar with VC++ as my first language, i tried to understand classes and all that as the first thing ! I didn't do too bad with vc++ so C / C++ shouldn't be as hard? Or "at least" not much of a change in the learning curve?

    Anyways...
    Someone answered a Q for me and i said i got it. I then replied that my source is up to 560 sumin lines and they told me "if that's all in one function you better be splitting it up".
    I can understand neatness, and i would like to do that, but how?

    #include needed stuff......

    int main()
    {
    message;
    return 0;
    }

    int message()
    {
    printf("a message!");
    or
    cout<<a message!");
    }

    How would i do this type of a thing? I saw some source and someone had loads of functions and in the main function they did just that. message; followed by blah; and stuff; or whatever, and it would then just activate all the code in the stuff function or whichever specified in main...... i can't it get to work.
    The world is waiting. I must leave you now.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > Yes, i've only been messing with C / C++ for around 2 weeks now.
    That's one problem - C/C++ is not a language - it's a strange mix of the two.

    > I did get familiar with VC++ as my first language
    This isn't a language either - it's one manufacturers implementation of C++, with a fancy IDE stuck on the front of it (editor, debugger, compiler, linker etc).

    > message;
    This isn't a function call. You've got to have the () to make it a function call.

    messge; by iself is valid C, but it does something which won't interest you for a while yet.

    To make the example work, you need...
    Code:
    // A prototype
    int message ( void );
    
    int main()
    {
        message();  // call - note the ()
        return 0;
    }
    int message()
    {
        printf("a message!");   // since you post on the C board
    }
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Unleashed
    Join Date
    Sep 2001
    Posts
    1,765

    no offense...

    I can resist this as it was begging me to do it.....

    > Yes, i've only been messing with C / C++ for around 2 weeks now.
    That's one problem - C/C++ is not a language - it's a strange mix of the two.

    Ok, that's correct. I have been looking at C & C++. Look at the top of your site, "Your resource for C/C++". - Is this inncorect English? You used it, why can't I? Im simply stating I have been researching alot on both.

    > I did get familiar with VC++ as my first language
    This isn't a language either - it's one manufacturers implementation of C++, with a fancy IDE stuck on the front of it (editor, debugger, compiler, linker etc).

    - corrects myself -
    I got familiar with Microsofts "user friendly" GUI, compiler that sucked ass, and development studio first.

    No flamming here, but, your correctional comment towards me came off as rude. You did help me out though, so i doubt you were flamming. Grrr, i still think that's offensive, oh well.
    The world is waiting. I must leave you now.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Stupid Newbie question
    By TimL in forum C++ Programming
    Replies: 4
    Last Post: 07-22-2008, 04:43 AM
  2. Newbie with Very Newbie Question
    By Jedi_Mediator in forum C++ Programming
    Replies: 18
    Last Post: 07-01-2008, 08:00 AM
  3. a stupid question from a newbie
    By newcomer in forum C++ Programming
    Replies: 4
    Last Post: 01-11-2003, 04:38 PM
  4. newbie class templates question
    By daysleeper in forum C++ Programming
    Replies: 2
    Last Post: 09-18-2001, 09:50 AM