本文整理汇总了C++中Number::reset方法的典型用法代码示例。如果您正苦于以下问题:C++ Number::reset方法的具体用法?C++ Number::reset怎么用?C++ Number::reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Number
的用法示例。
在下文中一共展示了Number::reset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main() {
int T, a;
Number N;
cin >> T;
for (int i = 0; i < T; i++) {
cin >> a;
N.reset();
for (int j = 2; j <= a; j++)
N.multi(j);
N.display();
cout << endl;
}
return 0;
}
示例2: readCharacter
//-------------------------------------------------------------------------------------------------
// FuntionName: readCharacter
// Purpose: read each character input from stdin, then add it to number object
// case charater is ' ' => build number.
// case charater is '\n' => Calculate a sum of squares for Line, then loop for other Line
// case charater is 'q' => end of test.
// Other case will be reject.
//--------------------------------------------------------------------------------------------------
bool readCharacter( Number& num, char*& buff, char& sign, bool& isInputIncorrect )
{
char c = getchar();
if( c == ENTER )
{
putc('\n',stdout);
}
else if( c != END_PROGRAM )
{
putc(c,stdout);
}
if( (c >= '0' && c <= '9') || c == ENTER || c == END_PROGRAM || c == '-' || c == ' ')
{
if(c == END_PROGRAM)
{
sign = END_PROGRAM;
return true;
}
else
{
if( c != ' ' && c != ENTER )
{
num.setListCharacter(c);
}
else
{
bool ret = num.setNumber();
if(ret)
{
countLine += num.getNumber() * num.getNumber();
num.reset();
}
else
{
num.reset();
countLine = 0;
isInputIncorrect = true;
return true;
}
if( c == ENTER )
{
char buf[10];
sprintf(buf,"%d\n",countLine);
appenData(buff,buf);
countLine = 0;
}
}
readCharacter(num, buff, sign, isInputIncorrect);
}
}
else
{
num.reset();
countLine = 0;
isInputIncorrect = true;
return true;
}
}