楼主能不能给我一份,谢谢!
[email protected]
[email protected]
解决方案 »
- 不包含适合于入口点的静态"Main()"方法
- C# bitmap 加载大图片报内存不足
- C# winform显示刷新
- 水晶报表的边框怎样自动扩大?
- 如何传空的参数
- 笔试试题(希望大家看一下)
- DataSet 与 DataReader 的区别!
- 100分求解票据批量打印的问题
- Insert添加重复数据报错
- 用ACCESS数据库文件时发现一个问题
- DllImport 出错 “Object reference not set to an instance of an object”
- api调用 出错 “Object reference not set to an instance of an object”
你在BAIDU自己搜一下有不少的
char str1[] = "abc";
char str2[] = "abc";
const char str3[] = "abc";
const char str4[] = "abc";
const char* str5 = "abc";
const char* str6 = "abc";
cout << boolalpha << ( str1==str2 ) << endl; // 输出什么?
cout << boolalpha << ( str3==str4 ) << endl; // 输出什么?
cout << boolalpha << ( str5==str6 ) << endl; // 输出什么? 2. 以下反向遍历array数组的方法有什么错误?
vector<int> array;
array.push_back( 1 );
array.push_back( 2 );
array.push_back( 3 );
for( vector<int>::size_type i=array.size()-1; i>=0; --i ) // 反向遍历array数组
{
cout << array[i] << endl;
} 3. 以下两条输出语句分别输出什么?
float a = 1.0f;
cout << (int)a << endl;
cout << (int&)a << endl;
cout << boolalpha << ( (int)a == (int&)a ) << endl; // 输出什么?
float b = 0.0f;
cout << (int)b << endl;
cout << (int&)b << endl;
cout << boolalpha << ( (int)b == (int&)b ) << endl; // 输出什么?
4. 以下代码有什么问题?
struct Test
{
Test( int ) {}
Test() {}
void fun() {}
};
void main( void )
{
Test a(1);
a.fun();
Test b();
b.fun();
} 5. 以下代码有什么问题?
cout << (true?1:"1") << endl; 6. 以下代码有什么问题?
typedef vector<int> IntArray;
IntArray array;
array.push_back( 1 );
array.push_back( 2 );
array.push_back( 2 );
array.push_back( 3 );
// 删除array数组中所有的2
for( IntArray::iterator itor=array.begin(); itor!=array.end(); ++itor )
{
if( 2 == *itor ) array.erase( itor );
} 7. 以下代码有什么问题?
void char2Hex( char c ) // 将字符以16进制
{
char ch = c/0x10 + '0'; if( ch > '9' ) ch += 7;
char cl = c%0x10 + '0'; if( cl > '9' ) cl += 7;
cout << ch << cl << ' ';
}
char str[] = "I love 中国";
for( size_t i=0; i<strlen(str); ++i )
char2Hex( str[i] );
cout << endl;
Answer: 1.Output: false
false
true 2.My Answer is : for( vector<int>::iterator intIterator = array.end()-1; intIterator != array.begin()-1; intIterator-- )
{
cout << *intIterator << endl;
}
3. 1 float -> int
1065353216 make float-stored units be int-stored
false
0
0 float and int 0 is the same
true
4. calling b.fun() has problems
5. the operands types after "?" must be the same
6. Erasing N elements causes N destructor calls and an assignment for each of the elements between the insertion point and the end of the sequence. No reallocation occurs, so iterators and references become invalid only from the first element erased through the end of the sequence.
7. Parsing ”中国 “ has some problems