CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9

Thread: C+

  1. #1
    Join Date
    Mar 2012
    Posts
    1

    C+

    Hello
    I was wondering if anyone know where I can fin a good glossary for C+ language. For instance cin means ????I think count.

    Thank you

  2. #2
    Lindley is offline Elite Member Power Poster
    Join Date
    Oct 2007
    Location
    Seattle, WA
    Posts
    10,895

    Re: C+

    There is no language "C+", but if you want a quick reference for C++, check out http://www.cplusplus.com/.

    cin has nothing to do with counting.

  3. #3
    Join Date
    Jul 2005
    Posts
    19

    Re: C+

    Any book for C++ beginners can provide you such kind of glossary or visit the below link

    http://msdn.microsoft.com/en-us/library/3bstk3k5.aspx


    regards,
    vatsa
    www.objectiveprogramming.com

  4. #4
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,675

    Re: C+

    And, mainly for the sake of completeness, here's what you literally asked for: a glossary (from a really authoritative source ): http://www2.research.att.com/~bs/glossary.html

    It does explain cin, but that explanation is just two words. The other two links posted are somewhat more instructive...
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

  5. #5
    Join Date
    Jan 2010
    Posts
    1,133

    Re: C+

    I agree that we should point the OP to a reference, however, I think that the question is of a slightly different nature - if the OP's native language is not English, and if the OP is just beginning C++, it might be hard for him/her to understand why things like cin or cout are named like that, or even that they don't represent C++ keywords. Basically, I think he/she asks what "cin" literally means, not just what it does? You know: why that specific name.

    If you think about it, it can be quite confusing for a non-English speaking novice, especially if he/she wasn't introduced yet to streams, or classes and objects for that matter.

    @OP: Take a look at this image:


    As you can see, the standard C++ library contains, among other things, these classes that help you work with streams.
    From the source page:
    A stream is an abstraction that represents a device on which input and ouput operations are performed. A stream can basically be represented as a source or destination of characters of indefinite length.

    Streams are generally associated to a physical source or destination of characters, like a disk file, the keyboard, or the console, so the characters gotten or written to/from our abstraction called stream are physically input/output to the physical device. For example, file streams are C++ objects to manipulate and interact with files; Once a file stream is used to open a file, any input or output operation performed on that stream is physically reflected in the file.
    So basically, the person(s) who created these classes followed a naming convention, to designate what the classes do.
    With that in mind, here's a quick glossary for you - this is what the names stand for:
    • ios = input/output stream
    • iostream = input/output stream
    • istream = input stream
    • ostream = output stream
    • fstream = file stream
    • ifstream = input file stream
    • ofstream = output file stream
    • cin = "c-in", or "c input" - the standard input stream
    • cout = "c-out", or "c output" - the standard output stream
    • cerr = "c error" - the standard error-output stream
    • clog = "c-log" - the standard log-output stream


    I hope you can see the pattern in the naming. Some things repeat in various forms because the implementations (that is, what they do, how they do it, and what they are used for) are different (some classes are used as base classes for the others, derived classes extend those base classes). In any case, to find out what exactly each of these is used for, you should consult a reference of some sort.

    Note: cin, cout, cerr, and clog have a black background in the image because these aren't classes, but objects ready-made for you. To use some of the other classes, you need to create their objects yourself (just like you can create variables and assign values to them). You'll learn all about that soon enough.

  6. #6
    Join Date
    May 2009
    Posts
    2,413

    Re: C+

    Quote Originally Posted by Japp View Post
    For instance cin means ????I think count.
    I'd say c refers to the C language and in to standard input.

    C has the notion of standard input and by default it's the keyboard. But it's also possible to redirect standard input when a C program is started, for example to a file. The program will work as before oblivious to the fact that the input character stream isn't typed-in by someone but is read from a file instead. It's even possible to redirect standard input to another program. Then the program reading from standard input will get its input characters from the standard output of another program. One program is acting keyboard for another program. Pretty cool.

    Now since C++ is an extension of C it also has a standard input and cin denotes that this is the C++ way of doing standard input ala C.

  7. #7
    Join Date
    Oct 2002
    Location
    Austria
    Posts
    1,284

    Re: C+

    Quote Originally Posted by nuzzle View Post
    I'd say c refers to the C language and in to standard input..
    Funny, I never thought about the meaning of the c in cin/cout/cerr/clog.
    It was always clear for me that it means console. ( the standard in/output device )
    Kurt

  8. #8
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,765

    Re: C+

    Besides his C++ glossary, Stroustrup also has a C++ Style and Technique FAQ which states for cout that 'the "c" stands for "character" because iostreams map values to and from byte (char) representations.'

    This presumably also applies to cin.
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  9. #9
    Join Date
    Mar 2004
    Location
    Central Florida
    Posts
    293

    Re: C+

    TheGreatCThulhu, if the person's english is that bad, they won't unbderstand what you wrote. Any C++ book in their native language will explain it for them.
    "Effective teaching is the essence of leadership..."

    "There is no substitute for a carefully thought-out design."

    If you have found this post to be useful, please Rate it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured