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

TOP

返回列表