string :: size_type 的疑问
以下是显示```我们输入的2个字符串中谁比谁长```:#include <iostream>
#include <string>
using std :: cout ;
using std :: cin ;
using std :: endl ;
using std :: string ;
using string :: size_type ;
int main(void)
{
cout << "Please enter tow strings :" << endl ;
string str1, str2 ;
if( !(cin >> str1 >> str2) )
{
return -1 ;
}
size_type size1, size2 ;
size1 = str1.size() ;
size2 = str2.size() ;
string first, second ;
if ( size1 == size2 )
cout << "Tow strings have same length." << endl ;
else if( size1 > size2 )
{
first = "First" ;
second = "second" ;
}
else
{
first = "Second" ;
second = "first" ;
}
cout << first << " string is longer than "
<< second << "string ."
<< endl ;
return 0 ;
}
我发生的问题是```将string :: size_type单独放到程序声明对象时程序没错``
可以我用using声明就回出错```说是size_type没有定义``第一次使用``
这是怎么回事啊```应该怎么解决啊```请帮帮忙谢谢``