How do you?

This is a discussion on How do you? within the C++ Programming forums, part of the General Programming Boards category; start a code? do you always start with include <iostream> ? and what should i always keep in mind when ...

  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    1

    How do you?

    start a code? do you always start with include <iostream> ? and what should i always keep in mind when working with codes?

  2. #2
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    You generally start it with a tutorial.

    Cheers
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Apparently we have a new forum bug. They have zero posts, and yet, there is one...

    Quzah.
    Hope is the first step on the road to disappointment.

  4. #4
    People Love Me
    Join Date
    Jan 2003
    Posts
    412
    Push the big red button.

    But actually, in every console program you need to have main().

    Code:
    int main(){
    //Code....
    return 0;
    }
    Will be the format for your most very basic programs. You might want to read some tutorials to learn about variables, conditional testing, and all sorts of other goodies to get you off the ground.

    That lovely iostream file isn't ALWAYS needed, but in most console programs in C++, it's pretty much a neccesity. It contains several input and output functions, like cin (C input) and cout (C output), which take in data from the user and print out data, respectively.
    Last edited by Krak; 01-31-2005 at 10:35 PM.

  5. #5
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    Quote Originally Posted by quzah
    Apparently we have a new forum bug. They have zero posts, and yet, there is one...

    Quzah.
    Come on now... This is a CS board. </inane remark>
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  6. #6
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    Quote Originally Posted by Krak
    like cin (C input) and cout (C output)
    that's odd, I thought they were classes, which was always a C++ thing... why would they be called C input and output if they are a C++ thing?

    squawktheelf: the correct answer is: start every program with a comment. The name of the program, a brief description, and your name. it's also a good idea to include the date.
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  7. #7
    Carnivore ('-'v) Hunter2's Avatar
    Join Date
    May 2002
    Posts
    2,879
    >>why would they be called C input and output if they are a C++ thing?
    They're "console in" and "console out".

    And I agree with Zach, a tutorial is usually a good place to start
    Just Google It. √

    (\ /)
    ( . .)
    c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.

  8. #8
    Registered User
    Join Date
    Apr 2003
    Posts
    78
    That is correct for you for now sir.

  9. #9
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    Quote Originally Posted by Hunter2
    >>why would they be called C input and output if they are a C++ thing?
    They're "console in" and "console out".
    and it's "sarcasm"
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  10. #10
    People Love Me
    Join Date
    Jan 2003
    Posts
    412
    Code:
    int main(){
    for (;;){
    SpreadViruses();
    Hack_Govt_Agencies();
    }
    return 0;
    }

  11. #11
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Why are we hacking Govtcheez's agencies?
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  12. #12
    People Love Me
    Join Date
    Jan 2003
    Posts
    412
    Quote Originally Posted by XSquared
    Why are we hacking Govtcheez's agencies?
    He called me fat.

  13. #13
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    But you are...
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  14. #14
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    Some background for 'ya, squawktheelf,

    Standard C++ includes 51 function libraries which are "pointed-to" by including the associated header file. For example, you can add, subtract multiply, and divide without any headers, but if you want to perform a square-root, you #include <cmath> which has the sqrt() function. And, <ctime> has functions (and other stuff) for working with dates & times, etc.

    Most compilers will have additional non-standard headers.

    They have zero posts, and yet, there is one...
    You might be a programmer if... You always start counting at zero!

  15. #15
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    Quote Originally Posted by Krak
    He called me fat.
    and he resigned...
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21