|
一般来说, 一个软件工程师将按如下几个阶段成长下去:
*****中学阶段*****--------------------------------------
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 |
|