CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 12 of 12
  1. #1
    Join Date
    Dec 2002
    Location
    Birmingham UK
    Posts
    83

    Angry 2 Question where can i find graphic file , is there a online dictionary for C++

    I am kind of stuck dude's , i recently started my first c++ course and i could tell you this much my teacher is next to nothing , and therefore i need some sort of help ,

    i need to example to the exam person what the following mean

    #define
    int main()
    return ( i think this means it returns a value )
    void main() ( this one means no value is being pass throught)
    cout<< ( this mean a string is being out putted )
    cin>> ( receive a input from a keyboard )
    ; semi colon ( this tell the preprocessor which line to compliler )
    // ( this is comment )


    so you see if there was a online reference book free i can just check the meaning of the above and hopefull pass with some hands one practise .


    my second question is i want to include in some of my basic program some basic graphic is this possible in C++ if so how
    Waheed Rafiq

    www.waheedrafiq.com


    MCP x 2 , Network+.CNNA

  2. #2
    Join Date
    Mar 2002
    Location
    California
    Posts
    1,582
    You need a book. There are online references, and a simple search should find them.

    #define is a precompiler directive, as is anything beginning with '#'. Before actual compiling, there is a step that processes all of these. For #define, it defines a symbol or replaces a symbol everwhere below in your file.

    'int main()' is the main entry point for your program. When the program executes, this is where it starts as far as you are concerned.

    'return' returns a value to the caller, or in the case of main(), returns the value back to the OS or shell.

    cin and cout are indeed used for input and output. There's a lot of detail as to what these things actually are, but that's not really important at the start.

    ';' separates statements, either lines of execution or different parts of the 'for' statement.

    '//' is a comment.

    Graphics rely on what OS you are using, and often involve some larger framework. This question is too broad, and if you're still struggling with main() and return, probably too advanced at the moment.

    Jeff

  3. #3
    Join Date
    Dec 2002
    Location
    Birmingham UK
    Posts
    83

    Wink

    Thanks for your reply
    Waheed Rafiq

    www.waheedrafiq.com


    MCP x 2 , Network+.CNNA

  4. #4
    Join Date
    Apr 1999
    Location
    Altrincham, England
    Posts
    4,470
    By the way: "void main()" is a syntax error. Don't let anyone tell you any differently.
    Correct is better than fast. Simple is better than complex. Clear is better than cute. Safe is better than insecure.
    --
    Sutter and Alexandrescu, C++ Coding Standards

    Programs must be written for people to read, and only incidentally for machines to execute.

    --
    Harold Abelson and Gerald Jay Sussman

    The cheapest, fastest and most reliable components of a computer system are those that aren't there.
    -- Gordon Bell


  5. #5
    Join Date
    Dec 2002
    Location
    Birmingham UK
    Posts
    83
    haaaaaaaaaa my tutor told me that when you have void main() it basically means no value is being pass


    there was no mention about synax error
    Waheed Rafiq

    www.waheedrafiq.com


    MCP x 2 , Network+.CNNA

  6. #6
    Join Date
    Mar 2002
    Location
    California
    Posts
    1,582
    Well, it's a syntax error according to the C++ standard, not necessarily a sytax error with a given compiler.

    Whatever you want to call it, 'void main()' is wrong.

    Jeff

  7. #7
    Join Date
    Apr 1999
    Location
    Altrincham, England
    Posts
    4,470
    If it's not a syntax error with a given compiler, then the compiler is in error. "void main()" is wrong, wrong, wrong. It is non-standard. It is an ex-statement. It has gone to join the code invisible. If it wasn't for Microsoft *, it would be pushing up daisies.
    haaaaaaaaaa my tutor told me that when you have void main() it basically means no value is being pass


    there was no mention about synax error
    Get a new tutor, the one you've got is broken.



    * and a couple of others, I know.
    Correct is better than fast. Simple is better than complex. Clear is better than cute. Safe is better than insecure.
    --
    Sutter and Alexandrescu, C++ Coding Standards

    Programs must be written for people to read, and only incidentally for machines to execute.

    --
    Harold Abelson and Gerald Jay Sussman

    The cheapest, fastest and most reliable components of a computer system are those that aren't there.
    -- Gordon Bell


  8. #8
    Join Date
    Mar 2002
    Location
    California
    Posts
    1,582
    If it's not a syntax error with a given compiler, then the compiler is in error.
    Yup.

    Jeff

  9. #9
    Join Date
    Dec 2002
    Location
    Birmingham UK
    Posts
    83
    guy's what is the big fuss about I mean can you explain to me what is the big different in void main() and int main() as far as my little knowledge goes , one you can't pass a value ("void main() ") and the other you can pass a value "int main()"



    Waheed Rafiq

    www.waheedrafiq.com


    MCP x 2 , Network+.CNNA

  10. #10
    Join Date
    Mar 2002
    Location
    California
    Posts
    1,582
    It's simply not standard C++. 'void main()' is illegal. The only confusion is that certain compilers incorrectly accept it as a valid statement. It should not compile.

    Jeff

  11. #11
    Join Date
    May 2000
    Location
    Phoenix, AZ [USA]
    Posts
    1,347
    Originally posted by waheedrafiq
    guy's what is the big fuss about I mean can you explain to me what is the big different in void main() and int main() as far as my little knowledge goes , one you can't pass a value ("void main() ") and the other you can pass a value "int main()"
    See, here's what happened. A few compiler vendors [Microsoft
    included] messed up their compilers. They treated main() like any
    other function in some respects where it needed special process-
    ing. In this instance, main() needs to have an int return type, not
    void.

    So, people get all fired up because it rubs them the wrong way
    that Microsoft has the audacity to not only do something like this,
    but also get away with it.... Just take the lesson, say thank you,
    always have main() return int from now on, and it won't come up
    again

    You won't really notice any difference. It's technically not correct,
    but the argument is mostly for semantics....

    --Paul

  12. #12
    Join Date
    Dec 2002
    Location
    Birmingham UK
    Posts
    83
    discussion is now settle thanks forks for all your support
    Waheed Rafiq

    www.waheedrafiq.com


    MCP x 2 , Network+.CNNA

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured