Thread: Counting input words

  1. #16
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    Did you just do the problem for him (or her)? Why?

  2. #17
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    Well..... yes.... I guess I did finish it. Not sure how I can justify my action. I guess I figured the OP was pretty much there and had demonstrated real effort towards solving it, but was over complicating things.

    No excuses. I finished it for them. If the mods feel it is inappropriate, pull it.

  3. #18
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    There's no official rule against doing people's work for them that I know of, and I didn't think it was a homework assignment (it might be), so it's not that big of a deal. I was just wondering. If you feel it is inappropriate, then you can pull it.
    Last edited by Daved; 01-17-2008 at 01:14 PM.

  4. #19
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    You just copied the poor indenting, too. The OP is mixing tabs n' spaces!
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  5. #20
    Registered User
    Join Date
    Jan 2008
    Posts
    11
    Quote Originally Posted by Elysia View Post
    You just copied the poor indenting, too. The OP is mixing tabs n' spaces!
    How am I? If the tabs don't line up like I want them to, I use spaces to put them in the right position.

    Thanks for the solve, Todd Burch, I see now what I did wrong. And no, this was not a homework assignment.

  6. #21
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by Soulrivers View Post
    How am I? If the tabs don't line up like I want them to, I use spaces to put them in the right position.
    But the thing is, you shouldn't. Just use tabs to indent, and you don't need to line it up anymore.
    Mixing the two will only cause the code to become misaligned when you copy it elsewhere, outside your IDE.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #22
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Alternatively, just use spaces to indent. This is a situation where you cannot have your tabs and eat the spaces too
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  8. #23
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Elysia View Post
    But the thing is, you shouldn't. Just use tabs to indent, and you don't need to line it up anymore.
    Mixing the two will only cause the code to become misaligned when you copy it elsewhere, outside your IDE.
    Or use all spaces - most editors/IDE's have a setting to select whether you want spaces or tabs for indentation.

    Modern editors and IDE's are also usually capable of "autoindenting", which will make life better for you.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  9. #24
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Or just use all tabs! You don't need to line-up code at all. Tabs is perfectly fine for making readable code!
    Tabs vs. spaces is a big argument with both sides favoring one over the other, so there's no real point in saying which one is better.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  10. #25
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Elysia View Post
    Or just use all tabs! You don't need to line-up code at all. Tabs is perfectly fine for making readable code!
    Tabs vs. spaces is a big argument with both sides favoring one over the other, so there's no real point in saying which one is better.
    Yes - what I said was just that there are two alternatives [I have my thoughts about which is better, and I know this is just as difficult to resolve as the battle over which Christian form is "better" - Protestantism or Catholicism]. But there's absolutely no need to MIX the two - that is DEFINITELY a way to confuse everything and anything.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  11. #26
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by matsp View Post
    But there's absolutely no need to MIX the two - that is DEFINITELY a way to confuse everything and anything.
    100% Agreed
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  12. #27
    Registered User
    Join Date
    Jan 2008
    Posts
    11
    Fine, I see your point. I'll try using only tabs in the future, thanks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. counting lines , chars from an input file need help
    By Mshock in forum C++ Programming
    Replies: 26
    Last Post: 07-12-2006, 11:30 AM
  2. Trouble with a lab
    By michael- in forum C Programming
    Replies: 18
    Last Post: 12-06-2005, 11:28 PM
  3. Words waiting in input buffer
    By the person in forum C++ Programming
    Replies: 2
    Last Post: 10-09-2001, 09:44 AM