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

TOP

返回列表