메뉴 건너뛰기

Programing

C++ 프로그래밍

치환연산자

관리자2 2019.01.21 18:38 조회 수 : 85

#include <iostream>
using namespace std;

int main(int argc,char* argv[])
{
 int x = 1;
 int y = 2;
 int z = 3;
 int w = 4;
 int v = 5;
 int aa,bb;
 aa=bb=1;
 int a = x+=1;
 int b = x-=1;
 int c = x*=2;
 int d = x/=2;
 int e = x%=2;
 cout<<"X += 1 --> "<< a<<"\n";
 cout<<"Y -= 1 --> "<< b<<"\n";
 cout<<"Z *= 2 --> "<< c<<"\n";
 cout<<"W /= 2 --> "<< d<<"\n";
 cout<<"V %= 2 --> "<< e<<"\n";
 cout<<"a = "<< aa<<"b = "<< bb<<"\n";
}

-----------------------------------------------------------

치환연산자에는 +=  ,  -=  ,  *=  ,  /=  ,  %=가 있다.

위로