返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. void count(int n,string s)
  5. {
  6.     for(int i=1;i<=n;i++){
  7.                 cout<<"第"<<i<<"次的"<<s<<endl;
  8.         }
  9. }
  10. void print(string s){
  11.         int n;
  12.         cout<<"你要幾次?";
  13.         cin>>n;
  14.         count(n,s);
  15. }

  16. int main()
  17. {
  18.     string str;
  19.     cout<<"你要印什麼?";
  20.     cin>>str;
  21.     print(str);
  22.     system("pause");
  23.     return 0;   
  24. }
複製代碼

TOP

返回列表