cin | C++ boshlang’ich

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 ” << yo…


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 🎖

  1. 2-9 oraliqdagi biror raqam kiritilganda o'sha raqamning karra jadvalini chop etadigan dastur yozing.

O'zingizni sinab ko'ring



This content originally appeared on DEV Community and was authored by Wahid Abduhakimov


Print Share Comment Cite Upload Translate Updates
APA

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/

MLA
" » cin | C++ boshlang’ich." Wahid Abduhakimov | Sciencx - Sunday March 27, 2022, https://www.scien.cx/2022/03/27/cin-c-boshlangich/
HARVARD
Wahid Abduhakimov | Sciencx Sunday March 27, 2022 » cin | C++ boshlang’ich., viewed ,<https://www.scien.cx/2022/03/27/cin-c-boshlangich/>
VANCOUVER
Wahid Abduhakimov | Sciencx - » cin | C++ boshlang’ich. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/03/27/cin-c-boshlangich/
CHICAGO
" » cin | C++ boshlang’ich." Wahid Abduhakimov | Sciencx - Accessed . https://www.scien.cx/2022/03/27/cin-c-boshlangich/
IEEE
" » cin | C++ boshlang’ich." Wahid Abduhakimov | Sciencx [Online]. Available: https://www.scien.cx/2022/03/27/cin-c-boshlangich/. [Accessed: ]
rf:citation
» cin | C++ boshlang’ich | Wahid Abduhakimov | Sciencx | 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.

You must be logged in to translate posts. Please log in or register.