首页 | 编程语言 | 网站建设 | 游戏天堂 | 冲浪宝典 | 网络安全 | 操作系统 | 软件时空 | 硬件指南 | 病毒相关 | IT 认证
软讯网络 > 编程语言 > C/C++ > 麒麟软件的笔试题
【标  题】:麒麟软件的笔试题
【关键字】:
【来  源】:http://blog.csdn.net/andylin02/archive/2007/04/09/1557288.aspx

麒麟软件的笔试题

两个改错题

///file 01
#include <iostream>
#include <string.h>
using namespace std;
class mystring
{
public:
 
 char* pdata;
 mystring(int len)
 {
  pdata = new char(len);
 }
};

void fun(mystring** array, int len)
{
 mystring* old = *array;
 *array = new mystring(2*len);
 memcpy(*array, old, len);
 delete old;
}

int main()
{
 mystring str(20);
 mystring* pstr = &str;
 mystring** ppstr = &pstr;
 strcpy(str.pdata, "hello, andylin");
 fun(ppstr, 20);
 return 0;
}

///
#include <iostream>
#include <string.h>
using namespace std;

char* str1 = "hello, andylin";
char  str2[20] = "\0";
void foo(char* a, char* b, int len)
{
 switch (len & 0x7)
 {
 default:
  while (len > 7)
  {
   len -= 8;
   *b++ = *a++;
  case 7:
   *b++ = *a++;
  case 6:
   *b++ = *a++;

  case 5:
   *b++ = *a++;

  case 4:
   *b++ = *a++;
  case 3:
   *b++ = *a++;
  case 2:
   *b++ = *a++;
  case 1:
   *b++ = *a++;
  }
 }
}

int main()
{
 foo(str1, str2, strlen(str1));
 cout << "str1 = " << endl;
 cout << str1 << endl;
 cout << "str2 = " << endl;
 cout << str2 << endl;
}
 

百度笔试题:【上一篇】
Effective C++读书笔记之了解C++默默编写并调用哪些函数:【下一篇】
【相关文章】
没有相关文章
【随机文章】
  • 未来的世界—推动网络游戏发展的技术揭秘
  • 自定义file类型input框样式的方法
  • 利用RMAN复制改变实例名
  • ASP常用数据库连接及操作的方法和技巧
  • 感慨:编写坚固的代码
  • 数学之美 系列一 -- 统计语言模型(转载)
  • 在Web applications间共享数据
  • compass学习笔记2--对象搜索引擎映射
  • 塑封料、包封料、绝缘粉末、模塑料、保密胶、环氧塑封料、环氧绝缘粉末、黑胶、高温包封料
  • DEBUG API写简单的Loader
  • 【相关评论】
    没有相关评论
    【发表评论】
    姓名:
    邮件:
    随机码*
    评论*
          
    |  首 页  |  版权声明  |  联系我们   |  网站地图  |
    CopyRight © 2004-2007 软讯网络 All Rigths Reserved.