Thread: Need study help : /

  1. #16
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    thnx man, i am really going to enjoy the system dependant answer, seriously i cant wait till she marks it wrong.

  2. #17
    Registered User
    Join Date
    Feb 2003
    Posts
    596
    >>Explain the empty for loop

    The counter is declared and initialized outside of the loop condition but referenced in conditional statements within the loop.
    Wrong!!
    "Empty" refers to the loop body. It just means that all the "action" is inside the parentheses. An example is:
    Code:
    for( d=2; d < n && n / d != 0; d++ ) ;  // exits loop when d is a divisor of n (or d==n)
    Some people prefer this style:
    Code:
    for( d=2; d < n && n / d != 0; d++ )
         ;
    or this:
    Code:
    for( d=2; d < n && n / d != 0; d++ )
         {};
    to make it clear that it's not just a mistake.

    Another name for this is a Null Statement.

  3. #18
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    are you sure she's not looking for a relativity answer? as in:

    unsigned<float<double
    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

  4. #19
    Registered User
    Join Date
    Feb 2003
    Posts
    596
    golfinguy4:

    Are you sure? I've only seen for(;;); referred to as an infinite loop, same as while(1);

    RoD:
    Your post wasn't clear. Did teacher give for(;;) as an example?
    Last edited by R.Stiltskin; 05-29-2003 at 07:21 PM.

  5. #20
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    well i asked bout it today and i posted what she said she wanted.

    Code:
    int i = 0;
    
    for (; i < 5; i++)
    {
    cout << "Runs 5 times!" << endl;
    }

  6. #21
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    that just means the LCV is initialized outside the loop...
    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. #22
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    98) List the data types and number of bytes each:

    I have NO idea what the bytes are, but i listed char, int, double, float, bool, and string cuz we did those.
    Missed a couple there... Off the top of my head,

    char, int, short, long (each of which comes in signed and unsigned flavors)
    bool, float, double, long double
    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.

  8. #23
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    ya i only listed the ones she actually went over, cs2 sux for us

  9. #24
    Registered User
    Join Date
    Feb 2003
    Posts
    596
    Well, I don't see how she can call that an empty anything. It's not empty. I see examples like the one I posted and examples like the one golfinguy posted both being called empty loops. They both make sense. I don't see any that look like your teacher's.

    But she's marking the test. Too bad. Maybe you can ask her again, & show her our examples, before the test.

    Good luck.

  10. #25
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    Yeah, I'd say Stiltskin's is probably the most correct definition of empty loop... golfinguy's is probably technically an infinite loop, and not empty.

    Also, on the structure of a program, I'd put something like this (in no particular order):

    Pre-processor
    Global-Scope/Namespace-Scope Constants (If your teacher is really picky, I suppose typedefs would go here too)
    Function Prototypes
    Class Declarations
    Class Definitions
    Driver (i.e. main)
    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.

  11. #26
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138
    Yeah, my empty loop was wrong. I misread what he wanted.

  12. #27
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    well the test is in a few hours, and thnx to you guys im sure i'll pass it, thank ya.

  13. #28
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    good luck ;-)
    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

  14. #29
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    110 question study guide, TWO questions on the actual test. god i really hate that $$$$$

  15. #30
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    And the real test was to see if you could keep your sanity after all that.
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Computer Science Study tips?
    By Pyroteh in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 10-18-2005, 05:04 PM
  2. c-program for a case study!!!
    By zodi in forum C Programming
    Replies: 6
    Last Post: 07-29-2005, 02:38 PM
  3. Good colleges for language study
    By Lurker in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 10-16-2004, 08:30 PM
  4. Study Abroad
    By axon in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 09-17-2004, 12:13 AM
  5. Home study course on Visual C++, your opion please
    By 747ken in forum C++ Programming
    Replies: 9
    Last Post: 10-14-2003, 09:06 AM