Results 1 to 8 of 8

Thread: Newbie C++ programming,need help!

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    Mar 2013
    Posts
    4
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: Newbie C++ programming,need help!

    Hi,I am really glad someone has responded to my thread.I really appreciate it. The problem is I have not started in typing out the source code because I still couldn't find a way to solve it. I am still overwhelm by two factor:
    1) The total is being first specified by the user. This can be any number which I find it is 'Infinite' numbers for me to cater to.
    2) Subtraction ranging from 1 to N. The N can be any number which is in the sense 'Infinite' numbers.

    The book is really good in teaching C++ to newbie because of its simple explanation & exercises to apply what readers have learned from the book
    to help improve their programming skill.However, it somehow lack answers for the exercises provided.

    I have thought initially that maybe if I have a deep understanding of the previous example I could solve this exercise. I believe the preview coding which I have shown works because it always eliminates the remainder of the total number given by the user. So in anyway, even if the user randomly subtract the total, the logic is always to elminate the remainder by checking with %3.
    For example, let say the user provides a total of 10.
    11%3 will give a remainder of two. So I will subtract two from it forcing it to be a multiplication of 3.
    Therefore,the total now is 9.
    Next,let say the user subtracts 1.
    The total is 8.
    8%3 will give a remainder of two.I will then subtract two from it forcing it to be a multiplication of 3.
    The total is 6.
    .
    .
    .
    So do you see the pattern now?
    The program is designed that it will meet its target of reaching 3 to win the game.Why so?
    This I believe is also due to the program having the chance to start first in subtracting.
    Hence, whenever it reaches 3, the user will subtract and the computer will win the game by subtracting
    whatever is left.
    Yup,but I still can't figure out the exercise though.
    Do you have any idea of solving it?
    Last edited by bestmaster99; 14th March 2013 at 13:06.

Similar Threads

  1. a newbie..
    By Lady Sophia in forum General Discussion
    Replies: 3
    Last Post: 1st May 2012, 00:15
  2. Replies: 3
    Last Post: 25th September 2011, 18:41
  3. Newbie Says Hi
    By ScottBrady in forum General Discussion
    Replies: 1
    Last Post: 25th July 2011, 02:56
  4. Complete newbie with programming and Qt
    By Jacob in forum Newbie
    Replies: 1
    Last Post: 6th March 2010, 06:26

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.