摘要:
c/c++笔试面试题(3)2007-11-08 16:45903人阅读评论(0)收藏举报1.求下面函数的返回值(微软)int func(x){ int countx = 0; while(x) { countx ++; x = x&(x-1); } return countx;}假定x = 9999。 答案:8思路:将x转化为2进制,看含有的1的个数。2. 什么是“引用”?申明和使用“引用”要注意哪些问题?答:引用就是某个目标变量的“别名”(alias),对应用的操作与对变量直接操作效果完全相同。申明一个引用的时候,切记要对其进行初始化。引用声明完毕后,相当于目标变量名有两个名称,即该 阅读全文
posted @ 2012-11-28 17:57
可笑痴狂
阅读(541)
评论(0)
推荐(0)
摘要:
c/c++笔试面试题(1)2007-11-08 16:42460人阅读评论(0)收藏举报1. 以下三条输出语句分别输出什么?[C易]char str1[] = "abc";char str2[] = "abc";const char str3[] = "abc";const char str4[] = "abc";const char* str5 = "abc";const char* str6 = "abc";cout << boolalpha << 阅读全文
posted @ 2012-11-28 17:56
可笑痴狂
阅读(487)
评论(0)
推荐(0)
摘要:
c/c++笔试面试题(2)2007-11-08 16:43464人阅读评论(0)收藏举报int Strcmp(char *str1, char *str2){ int i=0; int b=0; while(str1[i]||str2[i]) { if(str1[i]>str2[i]) { b=1;break; } else if(str1[i]<str2[i]) { b=-1;break; } i++; } return b;}***************************************************************************** 阅读全文
posted @ 2012-11-28 17:56
可笑痴狂
阅读(297)
评论(0)
推荐(0)
摘要:
cin、cin.get()、cin.getline()、getline()、gets()等函数的用法2007-11-17 22:23898人阅读评论(0)收藏举报【原创】cin、cin.get()、cin.getline()、getline()、gets()等函数的用法2007/10/27 22:51学C++的时候,这几个输入函数弄的有点迷糊;这里做个小结,为了自己复习,也希望对后来者能有所帮助,如果有差错的地方还请各位多多指教(本文所有程序均通过VC 6.0运行)转载请保留作者信息;1、cin1、cin.get()2、cin.getline()3、getline()4、gets()5、get 阅读全文
posted @ 2012-11-28 17:49
可笑痴狂
阅读(260)
评论(0)
推荐(0)