answersLogoWhite

0

How do you use cin in C plus plus?

User Avatar

Anonymous

13y ago
Updated: 8/20/2019

The class cin is an iostream class that abstracts stdin, allowing you to read from the stdin (console input) file. For instance:

int age;

cout << "How old are you? ";

cin >> age;

cout << "You said you were " << age " years of age " << endl;

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

How you can use two input in a single statement in c plus plus?

cout&lt;&lt;"______": cin &gt;&gt;__&gt;&gt;__; [example cout&lt;&lt;"enter no."; cin&gt;&gt;a&gt;&gt;b; ]


Is cin an output identifier in c plus plus?

No. In C++ with &lt;iostream&gt;, cin is a prefedined class that represents stdin, so it is an input identifier.


Write in c-in and c-out in c plus plus and C programming?

In c++, to manipulate output & input you must use cin and cout. I will write a sample program to show you:#include //possibly iostream.husing namespace std; //This is what lets you use cin & coutint main(){cout


What is the c plus plus command to read a line?

You can use cin which located in iostream.h You have to use certain data type to read string, for instance, array of char


How do you use scanf with delimiter in c plus plus Please provide a basic example with output?

scanf does not employ a delimiter. It simply reads formatted input from std::cin.


What is difference between scanf and cin?

scanf is a function (available in C and C++)cin is an istream object (C++ only)Advice: when in doubt, use fgets+sscanf


Can cin and cout be used in the function definition of user defined functions in C plus plus?

The cin and cout entities (they are not statements) are C++ iostream library objects that allows access to "standard input" and "standard output". In C++, the statement cout > variable; allows reading from standard input to a variable.


Which function reads character into an array specified bt its parameter in c plus plus?

void foo (char&amp; c) { cin &gt;&gt; c; } int main() { char ch[10] {}; for (size_t c=0; c!=10; ++c) foo (c[0]); }


Can you write a program to read a set of scores from a file and compute the average and print it on the screenby c plus plus?

Yes. Use cin and/or getline to read the formatted data into an array, compute the average then output the result using cout.


How do you write a program in C plus plus to find volumn of a cuboid?

#include&lt;iostream.h&gt; void main() { int l,b,h,v; cout&lt;&lt;"Enter length "; cin&gt;&gt;l; cout&lt;&lt;"Enter breadth "; cin&gt;&gt;b; cout&lt;&lt;"Enter Height "; cin&gt;&gt;h; v=l*b*h; cout&lt;&lt;"Volume is "&lt;&lt;v; }


What is the C plus plus plus program for the addition of two numbers?

#include&lt;iostream&gt; int main() { int num1, num2; std::cout &lt;&lt; "C++ addition program" &lt;&lt; std::endl; std::cout &lt;&lt; "Enter a number: "; std::cin &gt;&gt; num1; std::cout &lt;&lt; "Enter another number: "; std::cin &gt;&gt; num2; std::cout &lt;&lt; "The sum is " &lt;&lt; num1 + num2 &lt;&lt; std::endl; }


1 Write a C plus plus program to read two integers and display them Use cin and cout statements?

#include &lt;iostream&gt; using namespace std; int main() { int x,y; cout&lt;&lt;"please, enter the 1st value : "; cin&gt;&gt;x; cout&lt;&lt;"please, enter the 2nd value : "; cin&gt;&gt;y; cout&lt;&lt;endl; cout&lt;&lt;"the first value is : "&lt;&lt;x&lt;&lt;endl; cout&lt;&lt;"the second value is : "&lt;&lt;y&lt;&lt;endl; return 0; }