温柔网

 找回密码
 注册

查看: 601|回复: 0

程之路(从超级菜鸟到CEO)

[复制链接]
发表于 2004-10-31 21:31:17 | 显示全部楼层 |阅读模式
一般来说, 一个软件工程师将按如下几个阶段成长下去:

  *****中学阶段*****--------------------------------------

  10 PRINT "HELLO WORLD"
  20 END

  *****大学一年级*****--------------------------------------

  program Hello(input, output)
  begin
  writeln('Hello World')
  end.

  *****大学高年级*****--------------------------------------

  (defun hello
  (print
  (cons 'Hello (list 'World))))

  *****初级程序员*****--------------------------------------

  #include
  void main(void)
  {
  char *message[] = {"Hello ", "World"};
  int i;
  for(i = 0; i < 2; ++i)
  printf("%s", message);
  printf("\n");
  }

  *****编程老鸟*****--------------------------------------

  #include
  #include
  class string {
  private:
  int size;
  char *ptr;
  public:
  string() : size(0),
  ptr(new char('\0')) {}
  string(const string &s) : size(s.size)
  {
  ptr = new char[size + 1];
  strcpy(ptr, s.ptr);
  }
  ~string()
  {
  delete [] ptr;
  }
  friend ostream &operator <<(ostream &, const string &);
  string &operator=(const char *);
  };
  ostream &operator<<(ostream &stream, const string &s)
  {
  return(stream << s.ptr);
  }
  string &string:perator=(const char *chrs)
  {
  if (this != &chrs)
  {
  delete [] ptr;
  size = strlen(chrs);
  ptr = new char[size + 1];
  strcpy(ptr, chrs);
  }
  return(*this);
  }
  int main()
  {
  string
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|温柔网 ( 浙ICP备13033583号-8 )

GMT+8, 2024-5-8 22:26 , Processed in 0.032936 second(s), 22 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表