/*
Description: 赋值操作符
*/#include<iostream>usingnamespace std;intget_value();intmain(){int a;
a =1;//赋值,不是等于
a = a+1;//不是等于,时赋值
cout<<a<<endl;int i,j,ival;
ival =5;
i =12;constint ci = i;// 1024 = i;
string s1,s2;
s1 = s2 ="OK";
cout<<s1<<" "<<s2<<endl;double d;// d = i = 3.5;
i = d =3.5;
cout<<d<<" "<<i<<endl;// int k = get_value();// while(k!=42)// {// cout<<"你输入的是:"<<k<<endl;// k = get_value(); // }int k;while((k =get_value())!=42){
cout<<"你输入的是:"<<k<<endl;}return0;}intget_value(){int res;
cout<<"请输入一个整数:"<<endl;
cin>>res;return res;}
002
/*
Description: 赋值操作符
*/#include<iostream>usingnamespace std;intmain(){int i;
cout<<"请输入一个整数:"<<endl;
cin>>i;//小心: = 和 == if(i ==42){
cout<<"你输入的是42!"<<endl;}else{
cout<<"你输入的不是42!"<<endl;}int a,b;
a =1;
b =2;// a = a + b;
a += b;// a = a - b;
a -= b;return0;}
001/* Description: 赋值操作符 */#include<iostream>using namespace std;int get_value();int main(){ int a; a = 1;//赋值,不是等于 a = a+1;//不是等于,时赋值 cout<<a<<endl; int i,j,ival; ival = 5; i = 12; const int ci = i; // 1024 = i;