Thread: Trying to make this counter output something different

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by NinjaFish View Post
    I tried taking that and trying to make it work with my program, however the only output was blank when I tried.
    Ummmm... when you've been doing your programming exercises have you been typing in the code yourself, or have you been cut/paste copying it from someplace?

    The reason I ask has to do with how people learn... for example, we learn spelling by writing, we learn language by speaking, that is, we mostly learn by doing. Having things done for us defeats the mechanism.

    My suggestion is that you start with a blank screen, set all other code aside, and come at this problem from a fresh perspective... But 100% of your own creation... By all means have your C library documentation handy and be eager to look things up in the process of figuring it out (many, many years into this and I still look stuff up all the time).

    Just make sure it's all yours in the end... What you learn will stay with you and you will understand it far better, when you're done.

    It's not an especially difficult problem --you aren't writing a missile guidence system-- so this should be a good exercise to help you get the basics down pat.

    The last code you posted is very close... Think in baby steps about the sequence of events you have to create. Remember that when programming you are dealing with a totally obedient idiot that's going to do exactly what you say and nothing else... you have to tell it everything and in the right order... You'll get it....

  2. #2
    Registered User
    Join Date
    Feb 2011
    Posts
    62
    Quote Originally Posted by CommonTater View Post
    Ummmm... when you've been doing your programming exercises have you been typing in the code yourself, or have you been cut/paste copying it from someplace?

    The reason I ask has to do with how people learn... for example, we learn spelling by writing, we learn language by speaking, that is, we mostly learn by doing. Having things done for us defeats the mechanism.

    My suggestion is that you start with a blank screen, set all other code aside, and come at this problem from a fresh perspective... But 100% of your own creation... By all means have your C library documentation handy and be eager to look things up in the process of figuring it out (many, many years into this and I still look stuff up all the time).

    Just make sure it's all yours in the end... What you learn will stay with you and you will understand it far better, when you're done.

    It's not an especially difficult problem --you aren't writing a missile guidence system-- so this should be a good exercise to help you get the basics down pat.

    The last code you posted is very close... Think in baby steps about the sequence of events you have to create. Remember that when programming you are dealing with a totally obedient idiot that's going to do exactly what you say and nothing else... you have to tell it everything and in the right order... You'll get it....

    As I said, i'v been working from examples. That above code is just a slightly modified example from the book. And yes i'v written it out. Multiple times. As a matter of fact, im heading on.. 4 and a half hours of sitting on this question, trying to work it out logically and make changes. However, I originally did C++ in my college course taught by a rather anal man whom expected perfection and the best possible professionally written program in a beginner course, which never helped. Since I am learning C, I am having a bit of a hard time adapting to the small syntax change C++ added, so C is not only being difficult, but I also have no knowledge, whatsoever, of characters in programming. The closest I ever even had to know was string, which isn't char.

    Also, my learning comes from two things -- visual reference // self-understanding of how the code works. Unfortunately, the text and code I'v been only outlines how the program works, and gives no way of how a negative counter can work with characters. And up until this example, everything has been basic numerics and printf statements.

  3. #3
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by NinjaFish View Post
    As I said, i'v been working from examples. That above code is just a slightly modified example from the book. And yes i'v written it out. Multiple times. As a matter of fact, im heading on.. 4 and a half hours of sitting on this question, trying to work it out logically and make changes. However, I originally did C++ in my college course taught by a rather anal man whom expected perfection and the best possible professionally written program in a beginner course, which never helped. Since I am learning C, I am having a bit of a hard time adapting to the small syntax change C++ added, so C is not only being difficult, but I also have no knowledge, whatsoever, of characters in programming. The closest I ever even had to know was string, which isn't char.

    Also, my learning comes from two things -- visual reference // self-understanding of how the code works. Unfortunately, the text and code I'v been only outlines how the program works, and gives no way of how a negative counter can work with characters. And up until this example, everything has been basic numerics and printf statements.
    Well, if you worked in C++ then you already know most of this stuff... you should know how for() loops work, about basic if/else structures, while() and do/while... you should already have all that stuff worked out or you'd never get a C++ program any bigger than "hello world" to work.

    C is a different language but not SO different you shouldn't be able to adapt rather easily...

    Take my word for it... staring at code teaches you nothing (as it would appear you are now discovering)... writing code, reading code... fixing broken code... now that's how you learn.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. can any one make this program run.. in proper output?
    By randyjhon143 in forum C++ Programming
    Replies: 3
    Last Post: 12-03-2009, 09:22 AM
  2. Promblem with code
    By watchdogger in forum C Programming
    Replies: 18
    Last Post: 01-31-2009, 06:36 PM
  3. Send output to keyboard buffer
    By DReynolds in forum C Programming
    Replies: 2
    Last Post: 06-06-2007, 03:44 PM
  4. Connecting input iterator to output iterator
    By QuestionC in forum C++ Programming
    Replies: 2
    Last Post: 04-10-2007, 02:18 AM
  5. Replies: 1
    Last Post: 12-31-2001, 05:04 PM