Thread: a little trouble understanding

  1. #1
    Registered User
    Join Date
    Sep 2003

    a little trouble understanding

    I am going through the tutorals to learn c++ on rgw cprogramming website, but i don't quite understand cin>> is for as an example on the last tutoral i did it's cin>>age; i just don't understand what this is telling the program. I know this is kind of a stupid basic question, but well all gotta start somewhere..

  2. #2
    Senior Member joshdick's Avatar
    Join Date
    Nov 2002
    Phildelphia, PA
    int main()
      int num;
      cout << "Enter a number: ";
      cin >> num;
      cout << "You entered " << num << endl;
      return 0;
    cin stands for console input. The statement above cin >> num; will wait until the user enters a number and then save that input to the variable num.

    "The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs." -- Joseph Weizenbaum.

    "If you cannot grok the overall structure of a program while taking a shower, you are not ready to code it." -- Richard Pattis.

  3. #3
    Registered User whistlenm1's Avatar
    Join Date
    Jan 2002
    cin >> age;

    cin == console input

    >> == stream extraction operator

    age == variable(int)

    cin >> enables you to input data into your program. In this case your entering a person's age into the variable(identifier) named(called) age. BTW data is inputted and outputted by means of
    streams. A stream is a consistent logical interface that is connected to a physical file(keyboard, monitor, floppy, ...).
    Man's mind once streched by a new idea, never regains its original dimensions
    - Oliver Wendell Holmes

    In other words, if you teach your cat to bark (output) and eat dog food (input) that doesn't make him a dog. It would have to chase cars, chew bones, and have puppies before I'd call it Rover ;-)
    - WaltP

  4. #4
    Registered User
    Join Date
    Sep 2003
    lol it's funny the way you both showed me is kinda confusing yet i somehow understand now it just kinda clicked, thanks.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Bolean Operators hurt my head. (Trouble understanding) :(
    By Funcoot in forum C++ Programming
    Replies: 3
    Last Post: 01-20-2008, 07:42 PM
  2. trouble understanding the source file structure
    By Mario F. in forum C++ Programming
    Replies: 5
    Last Post: 05-26-2006, 06:46 PM
  3. Trouble understanding malloc() syntax
    By Sereby in forum C Programming
    Replies: 21
    Last Post: 07-28-2004, 10:19 AM
  4. having trouble understanding this statement
    By kes103 in forum C++ Programming
    Replies: 2
    Last Post: 10-03-2003, 09:00 AM
  5. Trouble Understanding Classes and Objects. Please Help.
    By Jeffcubed in forum C++ Programming
    Replies: 4
    Last Post: 12-06-2002, 02:23 PM