C++ user input
int x; cout << "hurry, give me a number!: "; // Type a number and press enter cin >> x; // Get user input from the keyboard cout << "you picked: " << x << " !" // Display the input value OR use: getline >> (cin, variable-name); instead of cin >> x;
how to get input in cpp
// i/o example #include <iostream> using namespace std; int main () { int i; cout << "Please enter an integer value: "; cin >> i; cout << "The value you entered is " << i; return 0; }
Source: www.cplusplus.com
cin statement c++
#include <iostream> using namespace std; int main() { string nameEntered; cout << "Enter your name: \n"; cin >> nameEntered; cout << "So, your name is " << nameEntered; return 0; }
c++ cin operator
//Akbarali saqlagan C++ bo'yicha cin operatoriga ta'rif #include <iostream> using namespace std; int main (){ int a; cout << "Kattaroq sonni yozing: "; cin >> a; int b; cout << "Tepadaginga nisbatan kichik bo`lgan son(qiymatni) yozing: "; cin >> b; cout << "Birinchi kiritgan soningizdan ikkinchi kiitgan soningiz " << a-b << " marta katta ekanligi ma'lum bo'ldi.\n"; return 0; }
C++ cin cout
int age; cout << "How old are you ?" << endl; cin >> age;
cin c++
std::cin >> variable_name; //It takes input from the user