求解 大侠????

[复制链接]
查看11 | 回复10 | 2021-1-27 07:09:50 | 显示全部楼层 |阅读模式
刚学C++本周四有实验课。哪位大神能够告诉我*=(就知道是赋值)能说的具体点么??
分 -->
回复

使用道具 举报

千问 | 2021-1-27 07:09:50 | 显示全部楼层
*=是作乘法后再赋值,比如a*=b的意思是a=a*b。
回复

使用道具 举报

千问 | 2021-1-27 07:09:50 | 显示全部楼层
a*=b;
等价于
a=a*b;
回复

使用道具 举报

千问 | 2021-1-27 07:09:50 | 显示全部楼层
这个跟a+=a一样,实际的顺序是a=a*b
回复

使用道具 举报

千问 | 2021-1-27 07:09:50 | 显示全部楼层
a*=b等价a=a*b
回复

使用道具 举报

千问 | 2021-1-27 07:09:50 | 显示全部楼层
//C++Operators
//Operatorsspecifyanevaluationtobeperformedononeofthefollowing:
//Oneoperand(unaryoperator)
//Twooperands(binaryoperator)
//Threeoperands(ternaryoperator)
//TheC++languageincludesallCoperatorsandaddsseveralnewoperators.
//Table1.1liststheoperatorsavailableinMicrosoftC++.
//Operatorsfollowastrictprecedencewhichdefinestheevaluationorderof
//expressionscontainingtheseoperators.Operatorsassociatewitheitherthe
//expressionontheirleftortheexpressionontheirright;thisiscalled
//“associativity.”Operatorsinthesamegrouphaveequalprecedenceandare
//evaluatedlefttorightinanexpressionunlessexplicitlyforcedbyapairof
//parentheses,().
//Table1.1showstheprecedenceandassociativityofC++operators
//(fromhighesttolowestprecedence).
//
//Table1.1C++OperatorPrecedenceandAssociativity
//Thehighestprecedencelevelisatthetopofthetable.
//+------------------+-----------------------------------------+---------------+
//|Operator|NameorMeaning|Associativity|
//+------------------+-----------------------------------------+---------------+
//|::|Scoperesolution|None|
//|::|Global|None|
//|[]|Arraysubscript|Lefttoright|
//|()|Functioncall|Lefttoright|
//|()|Conversion|None|
//|.|Memberselection(object)|Lefttoright|
//|->|Memberselection(pointer)|Lefttoright|
//|++|Postfixincrement|None|
//|--|Postfixdecrement|None|
//|new|Allocateobject|None|
//|delete|Deallocateobject|None|
//|delete[]|Deallocateobject|None|
//|++|Prefixincrement|None|
//|--|Prefixdecrement|None|
//|*|Dereference|None|
//|&|Address-of|None|
//|+|Unaryplus|None|
//|-|Arithmeticnegation(unary)|None|
//|!|LogicalNOT|None|
//|~|Bitwisecomplement|None|
//|sizeof|Sizeofobject|None|
//|sizeof()|Sizeoftype|None|
//|typeid()|typename|None|
//|(type)|Typecast(conversion)|Righttoleft|
//|const_cast|Typecast(conversion)|None|
//|dynamic_cast|Typecast(conversion)|None|
//|reinterpret_cast|Typecast(conversion)|None|
//|static_cast|Typecast(conversion)|None|
//|.*|Applypointertoclassmember(objects)|Lefttoright|
//|->*|Dereferencepointertoclassmember|Lefttoright|
//|*|Multiplication|Lefttoright|
//|/|Division|Lefttoright|
//|%|Remainder(modulus)|Lefttoright|
//|+|Addition|Lefttoright|
//|-|Subtraction|Lefttoright|
//|>|Rightshift|Lefttoright|
//||Greaterthan|Lefttoright|
//|=|Greaterthanorequalto|Lefttoright|
//|==|Equality|Lefttoright|
//|!=|Inequality|Lefttoright|
//|&|BitwiseAND|Lefttoright|
//|^|BitwiseexclusiveOR|Lefttoright|
//
回复

使用道具 举报

千问 | 2021-1-27 07:09:50 | 显示全部楼层
BitwiseOR|Lefttoright|
//|&&|LogicalAND|Lefttoright|
//
回复

使用道具 举报

千问 | 2021-1-27 07:09:50 | 显示全部楼层
|LogicalOR|Lefttoright|
//|e1?e2:e3|Conditional|Righttoleft|
//|=|Assignment|Righttoleft|
//|*=|Multiplicationassignment|Righttoleft|
//|/=|Divisionassignment|Righttoleft|
//|%=|Modulusassignment|Righttoleft|
//|+=|Additionassignment|Righttoleft|
//|-=|Subtractionassignment|Righttoleft|
//|>=|Right-shiftassignment|Righttoleft|
//|&=|BitwiseANDassignment|Righttoleft|
//||=|BitwiseinclusiveORassignment|Righttoleft|
//|^=|BitwiseexclusiveORassignment|Righttoleft|
//|,|Comma|Lefttoright|
//+------------------+-----------------------------------------+---------------+

回复

使用道具 举报

千问 | 2021-1-27 07:09:50 | 显示全部楼层
引用1楼turingo的回复:*=是作乘法后再赋值,比如a*=b的意思是a=a*b。
正解
回复

使用道具 举报

千问 | 2021-1-27 07:09:50 | 显示全部楼层
引用5楼zhao4zhong1的回复:C/C++code?1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283//C++Operators//……这个最详细
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行