返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. void test(string sentence,int times)
  5. {
  6.         for(int i=0;i<times;i++)
  7.         {
  8.                 cout<<sentence<<endl;
  9.         }
  10. }
  11. int main()
  12. {
  13.         string sentence;int times=0;
  14.         cout<<"請輸入罰寫內容"<<endl;
  15.         cin>>sentence;
  16.         cout<<"請輸入次數"<<endl;
  17.         cin>>times;
  18.         test(sentence,times);
  19.         system("pause");
  20.         return 0;
  21. }
複製代碼

TOP

返回列表