0
It's always to use "using namespace std"in c++.....and I want to know cin is used for which purpose.
Please tell me the answer....as I'm a beginner in c++....I've just learn the basics.
8 Antworten
+ 8
cin is use to take input from user it is same as scanf function.
Why we using namespace
Consider a situation, we are writing some code that has a function called abc() and there is another predefined library available which is also having same function abc(). Now at the time of compilation, the compiler has no clue which version of abc() function we are referring to within our code.
To overcome this difficulty namespace is designed and is used as additional information to differentiate similar functions, variables, classes, etc. with the same name available in different libraries. Using namespace, we can define the context in which names are defined. In essence, a namespace defines a scope.
All C++ standard library types and functions are declared in the std namespace or namespaces nested inside std thus it is widely used in most of the programs.
but some old compilers won't supporting this . i also tried in turbo Compiler it will give you errors
+ 3
https://www.codingunit.com/cplusplus-tutorial-namespaces-and-anonymous-namespaces
https://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practice
cin is used to get the user input
https://www.sololearn.com/learn/CPlusPlus/1607/
https://www.geeksforgeeks.org/basic-input-output-c/
Try to search in google first for question
+ 2
Could you reword your question? This is all a bit confusing
+ 1
You’re telling the user to input variables “a” and “b” to decide their values, yet you defined them as “10” and “20”. Remove the “cin” statements if you want to get the sum of “a” and “b”.
0
Just see and tell me my mistake
0
Yah! I'm also getting confused 😅😅😅
0
NULL
thanks alot for your help ....I got the output thank you soo much 😊😇