OUT.CPP
上传用户:wszmarenbt
上传日期:2013-04-26
资源大小:2552k
文件大小:1k
源码类别:

Windows编程

开发平台:

Visual C++

  1. #include <conio.h>
  2. #include <iostream.h>
  3. typedef enum {MALE,FEMALE} SEX_TYPE;
  4. class RECORD
  5. {
  6. public:
  7. SEX_TYPE SEX;
  8. char *NAME;
  9. };
  10. ostream &operator<<(ostream &STREAM,RECORD PERSON)
  11. {
  12. if (PERSON.SEX == MALE) (STREAM<<"MALE");
  13. else (STREAM<<"FEMALE");
  14. return STREAM;
  15. }
  16. RECORD PEOPLE[10];
  17. int main(void)
  18. {
  19. PEOPLE[0].NAME="Mary";
  20. PEOPLE[0].SEX=FEMALE;
  21. PEOPLE[1].NAME="JOE";
  22. PEOPLE[1].SEX=MALE;
  23. clrscr();
  24. cout<<"n"<<PEOPLE[0].NAME<<"--->"<<PEOPLE[0];
  25. cout<<"n"<<PEOPLE[1].NAME<<"--->"<<PEOPLE[1];
  26. getch();
  27. return 0;
  28. }