Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
这个操作符在c++;? C++中的:什么? 与有什么区别吗?: 是接线员吗? 例如,在下面的代码中: // Extracting the coefficients and exponents as numbers int expon[21] = { 0 }; int coeff[21] = { 0 }; for (int i = 0; i < monoms; ++i) { int monomSize = monomStr[i].size(); for (int j = 0; j < monomSize; ++j) { if (monomStr[i][j] == '^') { expon[i] = stoi(monomStr[i].substr(j + 1, monomSize - j)); coeff[i] = stod(monomStr[i].substr(0, j)); break; } } } // Looking for the max of exponents int maxExponent = 0; for (int k : expon) // <---- **** this colon **** if (k >= maxExponent) maxExponent = k; // Generating the monomials of the null polynomial having 21ree = maxEponent std::string newMonom[21]; //将系数和指数提取为数字 int expon[21]={0}; int coeff[21]={0}; 对于(int i=0;i语法被称为“或有时被调用。”。_C++ - Fatal编程技术网

这个操作符在c++;? C++中的:什么? 与有什么区别吗?: 是接线员吗? 例如,在下面的代码中: // Extracting the coefficients and exponents as numbers int expon[21] = { 0 }; int coeff[21] = { 0 }; for (int i = 0; i < monoms; ++i) { int monomSize = monomStr[i].size(); for (int j = 0; j < monomSize; ++j) { if (monomStr[i][j] == '^') { expon[i] = stoi(monomStr[i].substr(j + 1, monomSize - j)); coeff[i] = stod(monomStr[i].substr(0, j)); break; } } } // Looking for the max of exponents int maxExponent = 0; for (int k : expon) // <---- **** this colon **** if (k >= maxExponent) maxExponent = k; // Generating the monomials of the null polynomial having 21ree = maxEponent std::string newMonom[21]; //将系数和指数提取为数字 int expon[21]={0}; int coeff[21]={0}; 对于(int i=0;i语法被称为“或有时被调用。”。

这个操作符在c++;? C++中的:什么? 与有什么区别吗?: 是接线员吗? 例如,在下面的代码中: // Extracting the coefficients and exponents as numbers int expon[21] = { 0 }; int coeff[21] = { 0 }; for (int i = 0; i < monoms; ++i) { int monomSize = monomStr[i].size(); for (int j = 0; j < monomSize; ++j) { if (monomStr[i][j] == '^') { expon[i] = stoi(monomStr[i].substr(j + 1, monomSize - j)); coeff[i] = stod(monomStr[i].substr(0, j)); break; } } } // Looking for the max of exponents int maxExponent = 0; for (int k : expon) // <---- **** this colon **** if (k >= maxExponent) maxExponent = k; // Generating the monomials of the null polynomial having 21ree = maxEponent std::string newMonom[21]; //将系数和指数提取为数字 int expon[21]={0}; int coeff[21]={0}; 对于(int i=0;i语法被称为“或有时被调用。”。,c++,C++,识别“运算符”和恰好是标点符号的语法片段之间的区别很重要。运算符作用于表达式以执行生成新表达式的某些效果从来都不是操作员;它只是指定语句或声明何时结束的语法+是一个运算符;它作用于两个表达式以生成一个新表达式 某些符号在某些位置可以是运算符,但在其他位置不能是运算符限定的模板参数 :永远不是运算符(即使在?:中,它也只是三元表达式中两个术语之间的分隔符);只是语法在一段语法中起着某种作用。在中,它将循环生成的变量的声明与生成变量的范围表达式分离。它可能是一个关键字,但是C++对添加新的关键字有点

识别“运算符”和恰好是标点符号的语法片段之间的区别很重要。运算符作用于表达式以执行生成新表达式的某些效果<代码>从来都不是操作员;它只是指定语句或声明何时结束的语法<代码>+是一个运算符;它作用于两个表达式以生成一个新表达式

某些符号在某些位置可以是运算符,但在其他位置不能是运算符<代码>限定的模板参数


永远不是运算符(即使在
?:
中,它也只是三元表达式中两个术语之间的分隔符);只是语法在一段语法中起着某种作用。在中,它将循环生成的变量的声明与生成变量的范围表达式分离。它可能是一个关键字,但是C++对添加新的关键字有点过敏,并且在可能的情况下更喜欢使用标点。<>代码>:< /Cord>语法被称为“或有时被调用。

”。
语法称为


至于两者之间的区别,条件运算符有点像是if语句的缩写。基于范围的循环(正如您可能猜到的)是循环排序的简写。

不,它是基于范围的循环。它从头到尾循环数组
expon
设置
k
expon
的每个元素。如果您的意思是
for(int k:expon)
它的范围为。这是否回答了您的问题?请参阅:循环。@XXX\u fam\u XXX您链接了一个答案。C++添加了冒号的一些额外用法(例如,构造函数中初始化器列表的开始或者只是请求的OP的范围循环),这些在C.中不存在。