作業-進階
大一程設
東華大學
東華大學資管系
基本程式概念
資管經驗分享
請寫一程式,其以Input這個function讓使用者輸入一個整數n跟一個字串s,而在Concatenate這個function中,把使用者輸入的字串s予以重覆串接n次後回傳。另外在Show這個function中將串接後的值輸出於螢幕上。例如使用者輸入的n值為3而s為hello,則輸出為hellohellohello。main function即依次呼叫這三個function。
Please write a program that uses the function Input to allow the user to enter an integer n and a string s. In the Concatenate function, a string formed by repeating the string s by n times is returned. In addition, the Show function outputs the concatenated string on the screen. For example, if the user enters n as 3 and s as hello, the output will be hellohellohellohello. The main function calls these three functions in turn.