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
Printable View
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
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.
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
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 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:
http://www.cplusplus.com/img/iostream.gif
As you can see, the standard C++ library contains, among other things, these classes that help you work with streams.
From the source page:
So basically, the person(s) who created these classes followed a naming convention, to designate what the classes do.Quote:
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.
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.
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.
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.
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.