Amperstands! Confusion. And Jargon.

This is a discussion on Amperstands! Confusion. And Jargon. within the C++ Programming forums, part of the General Programming Boards category; I would greatly appreciate if someone could help me out with just a few simple questions. What is the difference ...

  1. #1
    Registered User
    Join Date
    Aug 2006
    Location
    Edinburgh, Scotland
    Posts
    2

    Amperstands! Confusion. And Jargon.

    I would greatly appreciate if someone could help me out with just a few simple questions.

    What is the difference between (a & b) and (a && b)?
    What exactly is ment by "predefined loop constructs"?
    How would I go about writing a section of code to take a stream of characters from the keyboard as input and filter out the spaces? I'm not looking for code here, just a tip in the write direction.

    I would be very grateful if someone could help.
    Thanks.

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >What is the difference between (a & b) and (a && b)?
    The former represents a bitwise AND, the latter represents a boolean logical AND.

    >What exactly is ment by "predefined loop constructs"?
    Can you provide the context?

    >How would I go about writing a section of code to take a stream of characters
    >from the keyboard as input and filter out the spaces?
    Test for a space and ignore it if you find one:
    Code:
    while more characters
      read a character
      if not a space
        process
    loop
    My best code is written with the delete key.

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    22,302
    Homework questions?

    My hints would be:
    1. bitwise is not logical
    2. Read your textbook
    3. Overloaded operator>> can do formatted input
    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

  4. #4
    Registered User Tonto's Avatar
    Join Date
    Jun 2005
    Location
    New York
    Posts
    1,465
    1) Bitwise vs. Logical AND

    http://msdn2.microsoft.com/en-us/library/z0zec0b2.aspx
    http://msdn2.microsoft.com/en-us/library/c6s3h5a7.aspx

    2) In what context was this phrase used.

    3) string s,t; while(cin >> t) s += t;

    That filters all whitespace. The string t could also be used as a token not containing whitespace if that is what you wanted.

    Edit: That's just ridiculous. Haha.

    ╔╗╔╦══╦╗╔╦══╦╗
    ║╚╝║╔╗║╚╝║╔╗║║
    ║╔╗║╠╣║╔╗║╠╣╠╣
    ╚╝╚╩╝╚╩╝╚╩╝╚╩╝

    codez http://code.google.com/p/zxcvbn/

  5. #5
    Registered User
    Join Date
    Aug 2006
    Location
    Edinburgh, Scotland
    Posts
    2

    Cheers

    Thanks much, that's a great help.
    In reply to the context: I don't have Any i'm afraid. I'm doing a uni tutorial and i'm just not sure exactly what i'm being asked.
    Cheers again.

  6. #6
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >I'm doing a uni tutorial and i'm just not sure exactly what i'm being asked.
    I doubt the question is nothing more than what you gave us. Show us the complete question.
    My best code is written with the delete key.

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