當前位置: 首頁>>代碼示例>>C++>>正文


C++ std::islower方法代碼示例

本文整理匯總了C++中std::islower方法的典型用法代碼示例。如果您正苦於以下問題:C++ std::islower方法的具體用法?C++ std::islower怎麽用?C++ std::islower使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在std的用法示例。


在下文中一共展示了std::islower方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: main

int main()
{
   cout << "According to islower:\n"
      << ( islower( 'p' ) ? "p is a" : "p is not a" )    
      << " lowercase letter\n"
      << ( islower( 'P' ) ? "P is a" : "P is not a" ) 
      << " lowercase letter\n"
      << ( islower( '5' ) ? "5 is a" : "5 is not a" ) 
      << " lowercase letter\n"
      << ( islower( '!' ) ? "! is a" : "! is not a" ) 
      << " lowercase letter\n";

   cout << "\nAccording to isupper:\n"
      << ( isupper( 'D' ) ? "D is an" : "D is not an" ) 
      << " uppercase letter\n"
      << ( isupper( 'd' ) ? "d is an" : "d is not an" ) 
      << " uppercase letter\n"
      << ( isupper( '8' ) ? "8 is an" : "8 is not an" ) 
      << " uppercase letter\n"
      << ( isupper('$') ? "$ is an" : "$ is not an" ) 
      << " uppercase letter\n";

   cout << "\nu converted to uppercase is " 
      << static_cast< char >( toupper( 'u' ) )
      << "\n7 converted to uppercase is " 
      << static_cast< char >( toupper( '7' ) ) 
      << "\n$ converted to uppercase is " 
      << static_cast< char >( toupper( '$' ) ) 
      << "\nL converted to lowercase is " 
      << static_cast< char >( tolower( 'L' ) ) << endl;
   return 0;
} // end main
開發者ID:tecmilenio,項目名稱:computacion2,代碼行數:32,代碼來源:fig22_19.cpp

示例2: main

int main(int argc, const char *argv[])
{
	string str("hello world!");
	cout << "before: " << str << endl;

	string::iterator iter = str.begin();
	while (iter != str.end())
	{
		if (islower(*iter))
			*iter = toupper(*iter);
		++iter;
	}	
	cout << "after: " << str << endl;
	return 0;
}
開發者ID:CurvaVita,項目名稱:C--------C---Primer--,代碼行數:15,代碼來源:9_34.cpp

示例3: printLatinWord

void printLatinWord( char *x )
{
	char *y = x;
	int size = 0;
	while( *y != '\0' )
	{
		size++;
		y++;
	}
	char arr[ size + 3 ];
	strcpy( arr, x );
	char copy = arr[ 0 ];
	if ( islower( copy ) == false )
	{
		copy = tolower( copy );
		arr[ size - 1 ] = toupper( arr[ size - 1 ] );
	}
	arr[ 0 ] = arr[ size - 1 ];
	arr[ size - 1 ] = copy;
	arr[ size ] = 'a';
	arr[ size + 1 ] = 'y';
	arr[ size + 2 ] = '\0';
	cout << arr << ' ';
}	
開發者ID:michaelGitH,項目名稱:C-Programming,代碼行數:24,代碼來源:8.34.cpp


注:本文中的std::islower方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。