返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. void test(int a ;int b )
  5. {
  6.     for(int i=a;i>=b;i++)   
  7.     {
  8.        for(int j=a;j>=b;j++)
  9.        {
  10.          cout<<i<<"*"<<j<<"="<<i*j<<endl;      
  11.        }  
  12.     }   
  13. }
  14. int main()
  15. {
  16.        test(1,9)
  17.         system("pause");
  18.         return 0;
  19. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. double test(double a,double b)
  5. {
  6.         return a*b;
  7. }
  8. int main()
  9. {
  10.      int a=0,b=0;
  11.      cout<<"請輸入第一個數字"<<endl;
  12.         cin>>a;
  13.    cout<<"請輸入第二個數字"<<endl;
  14.         cin>>b;
  15.        for(int i=1;i<=a;i++)
  16.     {
  17.            for(int j=1;j<=b;j++)
  18.      {
  19.             cout<<i<<"*"<<j<<"="<<test(a,b)<<"\t";        
  20.        }
  21.         }
  22.         system("pause");
  23.         return 0;
  24. }
複製代碼

TOP

返回列表