I don't understand what this is asking!

This is a discussion on I don't understand what this is asking! within the C++ Programming forums, part of the General Programming Boards category; I have a book here, and there are exercises after each chapter. In chapter two - which is basic data ...

  1. #1
    C++ beginner
    Join Date
    Jun 2004
    Posts
    66

    I don't understand what this is asking!

    I have a book here, and there are exercises after each chapter. In chapter two - which is basic data types, there is an exercise that tells me to do this:
    Code:
    Here's an exercise for you puzzle fans. Write a program that will 
    prompt the user to enter two different positive integers. Identify in the
     output the value of the larger integer and the value of the smaller 
    integer.
    I have no idea what that is asking me to do. The book is - ivor Horton's Beginning ANSI C++: The complete Language.
    Oh my goodness.

  2. #2
    Registered User
    Join Date
    Jan 2006
    Posts
    19
    It is saying that you let the user enter two positive integers (1,2,3,4,....) and then compare the two and then show the user which one was larger and which one was smaller. This is simple.

  3. #3
    Slave MadCow257's Avatar
    Join Date
    Jan 2005
    Posts
    735
    Get two positive integers from user (you will use cin to get the input, which will be stored in 2 ints)
    Output them in the format "a > b" (you will use cout for this)

    The puzzle is determining the greater integer

  4. #4
    C++ beginner
    Join Date
    Jun 2004
    Posts
    66
    Thanks fellas - I really just wasn't sure what it meant.
    Oh my goodness.

  5. #5
    Registered User
    Join Date
    Apr 2003
    Posts
    2,662
    Hi,

    I learned C++ from that book, and I suggest that you skip the section on Bitwise Operators in Chapter 3. It is too difficult for beginners, and I think it should be in an appendix.

    If you need specific help with sections in that book, I should be able to help.

  6. #6
    C++ beginner
    Join Date
    Jun 2004
    Posts
    66
    Quote Originally Posted by 7stud
    Hi,

    I learned C++ from that book, and I suggest that you skip the section on Bitwise Operators in Chapter 3. It is too difficult for beginners, and I think it should be in an appendix.

    If you need specific help with sections in that book, I should be able to help.
    Thank you for the advice!
    Oh my goodness.

  7. #7
    chococoder
    Join Date
    Nov 2004
    Posts
    515
    bitwise operators are an essential part of the language, if you don't understand them study harder.

    Just because something isn't dead easy doesn't mean you're not supposed to know it.

  8. #8
    C++ beginner
    Join Date
    Jun 2004
    Posts
    66
    Quote Originally Posted by jwenting
    bitwise operators are an essential part of the language, if you don't understand them study harder.

    Just because something isn't dead easy doesn't mean you're not supposed to know it.
    I'm sure they are - but the problem is that the chapter gets very specific with binary code and hex values and I know next to nothing about binary and hex values and such... so it is VERY confusing to me. So I suppose once I get more comfortable with that sort of thing I'll re-visit it.
    Oh my goodness.

  9. #9
    chococoder
    Join Date
    Nov 2004
    Posts
    515
    that's a shortcoming on the part of your teacher and/or study material then. They should have prepared you better.

    Binary is easy. Remember there are two kinds of people, those who can count to 10 and those that can't, and you're halfway there.

    Hex takes some getting used to, but it's just another numeric base too. Base 16 it is, 0-F instead of 0-9.

  10. #10
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    21,593
    that's a shortcoming on the part of your teacher and/or study material then. They should have prepared you better.
    That is 7stud's point when giving the advice, if you did not notice. The book, according to 7stud, does not prepare beginners well when introducing bitwise operators.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  11. #11
    C++ beginner
    Join Date
    Jun 2004
    Posts
    66
    I think it assumes that you have knowledge of that sort. Though I suppose I understand what the bitwise operators do - I don't think that my understanding of hex, binary and the like will allow me to make much use of them. That is, until I learn about the stuff.
    Oh my goodness.

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