小豆子 发表于 2003-4-21 11:20:53

Hello World

老板 “乔治,我需要一个能打印'Hello World!'的程序”


初中/高中


    10 PRINT "HELLO WORLD"
    20 END



大学一年级


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



大学四年级


    (defun hello ()
      (print (list 'HELLO 'WORLD)))



刚参加工作


    #include <stdio.h>
    main (argc, argv)
    int argc;
    char **argv; {
    printf ("Hello World!n");
    }



老手


    #include <stream.h>

    const int MAXLEN = 80;

    class outstring;
    class outstring {
       private:

       int size;
       char str;

    public:
       outstring() { size=0; }
       ~outstring() { size=0; }
       void print();
       void assign(char *chrs);
    };
    void outstring::print() {
      int in;
      for (i=0; i<size; i++)
      cout << str;
      cout << "n";
    }
    void outstring::assign(char* chrs) {
      int i;
      for (i=0; chars!=''; i++)
      str = chrs;
      size=i;
    }

    main (int argc, char **argv) {
      outstring string;
      string.assign("Hello World!");
      string.print();
    }
页: [1]
查看完整版本: Hello World