当前位置: 首页>>代码示例>>C++>>正文


C++ LList::PrintList方法代码示例

本文整理汇总了C++中LList::PrintList方法的典型用法代码示例。如果您正苦于以下问题:C++ LList::PrintList方法的具体用法?C++ LList::PrintList怎么用?C++ LList::PrintList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LList的用法示例。


在下文中一共展示了LList::PrintList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main


//.........这里部分代码省略.........

		else if (output[charPointer] == '/'){
			skipComment(charPointer);
		}

		else if (output[charPointer] == '#'){
			//skip the directive and move the character pointer
			skipDirective(charPointer);
		}

		else if (strchr("+-/*=<>!&|[]", output[charPointer])){
			lexeme = findEndOperator(charPointer); //check if there are operators beside it too

			if (isOperator(lexeme)){
				numOfOperators++;

				char *cstr = new char[lexeme.length() + 1];
				strcpy(cstr, lexeme.c_str());
				// do stuff
				Operators.InsertInBack(cstr);
				delete[] cstr;
				
				
			}
		}

		else if (isPunctuator((output[charPointer]))){
			numOfPunctuators++;
			lexeme = output[charPointer];
			char *cstr = new char[lexeme.length() + 1];
			strcpy(cstr, lexeme.c_str());
			// do stuff
			Punctuators.InsertInBack(cstr);
			delete[] cstr;
			
			
		}

		else if (isdigit(output[charPointer])){

			//if it is a number, find its end
			lexeme = findEndOfNum(charPointer);

			if (isInteger(lexeme)){ //if the number is an integer, increment the number of integer constants
				numOfIntegerConstants++;
				numOfConstants++;
				char *cstr = new char[lexeme.length() + 1];
				strcpy(cstr, lexeme.c_str());
				// do stuff
				Constants.InsertInBack(cstr);
				delete[] cstr;
				
				

			}
			else if (isFloat(lexeme)) {//if it is a float, increment the number of float constants
				numOfFloatConstants++;
				numOfConstants++;
				char *cstr = new char[lexeme.length() + 1];
				strcpy(cstr, lexeme.c_str());
				// do stuff
				Constants.InsertInBack(cstr);
				delete[] cstr;
				
				
			}
		}

		charPointer++; //move the pointer to the next character.
	}
	cout << "\nNumber of keywords found is: " << numOfKeywords << '\n';
	cout << "\tkeywords found are: ";
	Keywords.PrintList();

	//cout << "\nNumber of boolean constants found is: " << numOfBooleanConstants << "\n";

	cout << "\n\nNumber of identifiers found is: " << numOfIdentifiers << "\n";
	cout << "\tIdentifiers found are: ";
	Identifiers.PrintList();


	cout << "\n\nNumber of operators found is: " << numOfOperators << "\n";
	cout << "\toperators found are: ";
	Operators.PrintList();

	cout << "\n\nNumber of Delimiters found is: " << numOfPunctuators << "\n";
	cout << "\tDelimiters found are: ";
	Punctuators.PrintList();

	cout << "\n\nNumber of Constants found is: " << numOfConstants << "\n";
	cout << "\tConstants found are: ";
	Constants.PrintList();

	cout << "\n\n Press any key to exit.";

	_getch();
	exit(0);


}
开发者ID:jhz1996,项目名称:Data-Structures,代码行数:101,代码来源:LexicalAnalysis.cpp


注:本文中的LList::PrintList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。