早教吧 育儿知识 作业答案 考试题库 百科 知识分享

c++具体在注释中,#includeshortfactor(int,int*,int*);intmain(){intnumber,squared,cubed;shorterror;//这里开始,这里声明了errorstd::coutnumber;error=factor(number,&squared,&cubed);//给error赋了值if(!error)//这块就不是很懂了

题目详情
c++具体在注释中,
#include
short factor(int,int*,int*);
int main()
{
int number,squared,cubed;
short error;//这里开始,这里声明了error
std::coutnumber;
error=factor(number,&squared,&cubed);//给error赋了值
if(!error)//这块就不是很懂了,我只能看明白当不是error的情况下(这个!error还有没有别的意思?),error是个什么情况啊?
{
std::cout
▼优质解答
答案和解析
if()里面能判断bool 值,也就是 0和1 当short是int的时候可以直接强制转换成bool进行条件判断.你的那个short factor(int n,int *psquared,int*pcubed)函数返回值只有0和1所有可以进行强制转换.
看了 c++具体在注释中,#inc...的网友还看了以下: