// C++ program to demonstrate the
// cin object
#include <iostream>
using namespace std;
// Driver Code
int main()
{
string s;
// Take input using cin
cin >> s;
// Print output
cout << s;
return 0;
}
cin >> variable;
// sample 1
int x;
cout << "x: ";
cin >> x;
cout << x << endl;
//sample 2
int num;
for (int i = 0; i < 10; i++){
cout << "Give a number: ";
cin >> num;
}
// C++ program to demonstrate the
// cin object
#include <iostream>
using namespace std;
// Driver Code
int main()
{
string s;
// Take input using cin
cin >> s;
// Print output
cout << s;
return 0;
}
cin >> variable;
// sample 1
int x;
cout << "x: ";
cin >> x;
cout << x << endl;
//sample 2
int num;
for (int i = 0; i < 10; i++){
cout << "Give a number: ";
cin >> num;
}
Code Example |
---|
Cpp :: c++ read each char of string |
Cpp :: destructor in c++ |
Cpp :: 1d array |
Cpp :: how to send email in c++ program |
Cpp :: check if character in string c++ |
Cpp :: input in c++ |
Cpp :: c++ how to read from a file |
Cpp :: create a 2d vector in c++ |
Cpp :: stl sort in c++ |
Cpp :: how to sort a string alphabetically in c++ |
Cpp :: uses of gamma rays |
Cpp :: sort vector in reverse order c++ |
Cpp :: print a string with printf in c++ |
Cpp :: std vector c++ |
Cpp :: print octal number in c++ |
Cpp :: cout c++ |
Cpp :: modulo subtraction |
Cpp :: inline in class in C++ |
Cpp :: lua table contains |
Cpp :: cpp mark getter as const |
Cpp :: new c++ |
Cpp :: power of a number |
Cpp :: Inner Section Sticky Scroll in elementor |
Cpp :: dynamic memory c++ |
Cpp :: travelling salesman problem c++ |
Cpp :: size of a matrix using vector c++ |
Cpp :: vectors c++ |
Cpp :: find function in c++ |
Cpp :: why do we use pointers in c++ |
Cpp :: qt make widget ignore mouse events |