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

Windows编程

开发平台:

Visual C++

  1. #include <stdio.h>
  2. #include <conio.h>
  3. #define NUMONE 'A'
  4. #define NUMTWO 10000
  5. #define NUMTHREE 10.0
  6. unsigned int AREA(unsigned char NUMBER);
  7. unsigned long AREA(unsigned int NUMBER);
  8. double AREA(double NUMBER);
  9. int main(void)
  10. {
  11. unsigned char NUMCHAR;
  12. unsigned int AREACHAR;
  13. unsigned int NUMINT;
  14. unsigned long AREALONG;
  15. double NUMDOUBLE,AREADOUBLE;
  16. NUMCHAR=NUMONE;
  17. NUMINT=NUMTWO;
  18. NUMDOUBLE=NUMTHREE;
  19. AREACHAR=AREA(NUMCHAR);
  20. AREALONG=AREA(NUMINT);
  21. AREADOUBLE=AREA(NUMDOUBLE);
  22.     printf("%d * %d = %dn",NUMCHAR,NUMCHAR,AREACHAR);
  23. printf("%d * %d = %ldn",NUMINT,NUMINT,AREALONG);
  24. printf("%lf * %lf = %lf",NUMDOUBLE,NUMDOUBLE,AREADOUBLE);
  25. getch();
  26. return 0;
  27. }
  28. unsigned int AREA(unsigned char NUMBER)
  29. {
  30. unsigned int RESULT;
  31. RESULT=NUMBER*NUMBER;
  32. return(RESULT);
  33. }
  34. unsigned long AREA(unsigned int NUMBER)
  35. {
  36. unsigned long RESULT;
  37. RESULT=(unsigned long)NUMBER*NUMBER;
  38. return(RESULT);
  39. }
  40. double AREA(double NUMBER)
  41. {
  42. double RESULT;
  43. RESULT=NUMBER*NUMBER;
  44. return(RESULT);
  45. }