This content originally appeared on DEV Community and was authored by Wahid Abduhakimov
cin
Ushbu operator foydalanuvchidan ma'lumotni so'rab uni vaqtinchalik hotiraga saqlash uchun ishlatiladi.
#include <iostream>
using namespace std;
int main()
{
int yosh;
cin >> yosh;
cout << "Siz " << yosh " yoshdasiz!" << endl;
}
Yuqoridagi kodni taxlil qilamiz:
-
int
butun sonlarni saqlab turish uchun xotiradan joy beradi va hotira variable(o'zgaruvchi deb ataladi) - yuqorida
int yosh;
degani hotiradan bitta butun son sig'adigan joy beriladi va uni yosh deb nomlanadi. Bu xotiraga endi istalgan butun son joylash mumkin. -
cin >> yosh;
esa console'dan bitta butun son o'qiydi va u sonni yosh nomli o'zgaruvchiga saqlaydi. - keyinigni qatorda yosh nomli o'zgaruvchini qiymati
cout
komandasi ichida chop etilyapti.
Bir nechta ma'lumotni o'qish
cin
komandasi orqali bir nechta o'zgaruvchiga qiymatlarni tengdaniga o'qish mumkin.
int yosh;
float vazn;
char baho;
cin >> yosh >> vazn >> baho;
cout << "Yosh = " << yosh << endl;
cout << "Vazn = " << vazn << endl;
cout << "Baho = " << baho << endl;
Yuqoridagi kodga 18 70.5 A
degan ma'lumotni kiritib tekshirib ko'ring.
Topshiriqlar 🎖
-
2-9
oraliqdagi biror raqam kiritilganda o'sha raqamning karra jadvalini chop etadigan dastur yozing.
This content originally appeared on DEV Community and was authored by Wahid Abduhakimov
Wahid Abduhakimov | Sciencx (2022-03-27T03:00:48+00:00) cin | C++ boshlang’ich. Retrieved from https://www.scien.cx/2022/03/27/cin-c-boshlangich/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.