DEV Community

etibor2006
etibor2006

Posted on

3

C ++ ASSIGMENT OPERATOR HAQIDA .

Biz int ishorasiniga bitta son belgilab uni keyinchalik boshqa songa o'zgartirsak ham bo'ladi.Ya'ni o'sha soni ichiga boshqa son qo'yishimiz mumkin digani.Miaol uchun...

  int a=10;
 string ism = "etibor";

  cout << a << endl;
  cout << ism << endl;

 a = 20;
 ism = "kimsan";
 cout << a << endl;
  cout << ism;
  return 0;
}

Enter fullscreen mode Exit fullscreen mode

int qilib a ni belgiladik.Yangi misol uchun bizga boshqa butun son kereak bo'lsa a = 20;qilib yozib ketsak bo'ladi.
Misolni teng ishorasidan kegn javobini qisqartirib yozishimiz ham mumkin.

 int a =5;
 int b = 6;

  b = b + a; // b += a;
 a + a - 10; // a-= 10;

 b*=;
 a /= b;
 cout << b; 
  return 0;
}
Enter fullscreen mode Exit fullscreen mode

b = b + a; qilib yozganimizdan koraroq qisqaroq qilib ham tezro ishlashimiz uchun b += b; hudi shunaqa qib yozsak ham bo'ladi.
Bu kodda yangi bir ishora yaratishimiz mumkin.

#include <iostream>
#include <cmath>
using namespace std;
int main4 (){

  int a = 5;
 int b = 2;

  a += 5;

  cout << a << endl;
  b -= 3;
 cout << b;
  return 0;
}
Enter fullscreen mode Exit fullscreen mode

@dawroun

AWS Q Developer image

Your AI Code Assistant

Generate and update README files, create data-flow diagrams, and keep your project fully documented. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay