1// cin with strings
2#include <iostream>
3#include <string>
4using namespace std;
5
6int main ()
7{
8 string mystr;
9 cout << "What's your name? ";
10 getline (cin, mystr);
11 cout << "Hello " << mystr << ".\n";
12 cout << "What is your favorite team? ";
13 getline (cin, mystr);
14 cout << "I like " << mystr << " too!\n";
15 return 0;
16}
1// i/o example
2
3#include <iostream>
4using namespace std;
5
6int main ()
7{
8 int i;
9 cout << "Please enter an integer value: ";
10 cin >> i;
11 cout << "The value you entered is " << i;
12 return 0;
13}
1//Akbarali saqlagan C++ bo'yicha cin operatoriga ta'rif
2#include <iostream>
3using namespace std;
4int main (){
5 int a;
6 cout << "Kattaroq sonni yozing: ";
7 cin >> a;
8 int b;
9 cout << "Tepadaginga nisbatan kichik bo`lgan son(qiymatni) yozing: ";
10 cin >> b;
11 cout << "Birinchi kiritgan soningizdan ikkinchi kiitgan soningiz " << a-b << " marta katta ekanligi ma'lum bo'ldi.\n";
12 return 0;
13}