本文整理汇总了C++中Counter::Count方法的典型用法代码示例。如果您正苦于以下问题:C++ Counter::Count方法的具体用法?C++ Counter::Count怎么用?C++ Counter::Count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Counter
的用法示例。
在下文中一共展示了Counter::Count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main()
{
Counter obj;
int n_min = 0;
int n_max = 0;
do{
cout << "Input min ";
cin >> n_min;
cout << "Input max ";
cin >> n_max;
if ((n_max < n_min) || (n_min == n_max)){
cout << "The maximum value should not be less than or equal to the minimum.";
}
} while ((n_max < n_min) || (n_min == n_max));
obj.InputMin(n_min);
obj.InputMax(n_max);
system("pause");
system("cls");
int key = 0;
do{
cout << "Select an action:\n"
"0. Exit.\n"
"1. An increase of 1.\n"
"2. Show the current value.\n";
cin >> key;
switch (key)
{
case 0:
break;
case 1:
obj.Count();
system("cls");
break;
case 2:
obj.Show();
system("pause");
system("cls");
break;
default:
cout << "Invalid input!";
system("pause");
system("cls");
break;
}
} while (key != 0);
}
示例2: checkString
void checkString(ofstream &out_stream, string fileString, char fileChar, int &locCount, Counter &loc, Counter &parenthesis)
{
bool found = false;
// if string is empty
if(fileString == "")
return;
// check against RESERVED array
for(int i = 0; i < 25; i++)
{
if(RESERVED[i] == fileString)
{
out_stream << "RESERVED" << " " << fileString << endl;
found = true;
locCounter(fileString, fileChar, locCount, loc);
}
}
// check against PREDEFINED array
for(int i = 0; i < 6; i++)
{
if(PREDEFINED[i] == fileString)
{
out_stream << "PREDEFINED" << " " << fileString << endl;
found = true;
}
}
// defaults to IDENTIFIER
if(!found)
{
out_stream << "IDENTIFIER" << " " << fileString << endl;
if(parenthesis.Count() == 1)
parenthesis.SetFlag(1);
}
}