It's always to use "using namespace std"in c++.....and I want to know cin is used for which purpose. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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.

7th Jul 2020, 3:57 AM
Navneet Kaur💫
Navneet Kaur💫 - avatar
8 Answers
+ 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
8th Jul 2020, 6:40 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 2
Could you reword your question? This is all a bit confusing
7th Jul 2020, 4:10 AM
♡Addy♡
♡Addy♡ - avatar
+ 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”.
7th Jul 2020, 6:51 AM
NULL
NULL - avatar
7th Jul 2020, 3:58 AM
Navneet Kaur💫
Navneet Kaur💫 - avatar
0
Just see and tell me my mistake
7th Jul 2020, 3:58 AM
Navneet Kaur💫
Navneet Kaur💫 - avatar
0
Yah! I'm also getting confused 😅😅😅
7th Jul 2020, 4:12 AM
Navneet Kaur💫
Navneet Kaur💫 - avatar
0
NULL thanks alot for your help ....I got the output thank you soo much 😊😇
7th Jul 2020, 10:03 AM
Navneet Kaur💫
Navneet Kaur💫 - avatar