Advertisement
kk258966

c++期末參考五

Jun 11th, 2014
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. int main(void)
  4. {
  5.  int x,y;
  6.  int add();
  7.  int minus();
  8.  int multiplication();
  9.  int division();
  10.  x=6;
  11.  y=3;
  12.  
  13.  printf("(x+y)(x-y)=%d\n",add(x,y));
  14. printf("a*a+a*b*3+b*b=%d\n",formula(x,y));
  15. printf("============================\n");
  16.  
  17.  
  18.     system("pause");
  19.     return 0;
  20. }
  21.  
  22. int add(int a,int b)
  23. {
  24.    return((a+b)*(a-b));    
  25. }
  26.  
  27.  
  28. int formula(int a,int b)
  29. {
  30.     int result;
  31.     result=pow(a,2)+3*a*b+pow(b,2);  //pow  指數  pow(a,2)  a的2次方
  32.    return(result);    
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement