複製字串

2021-06-21 06:28:47 字數 579 閱讀 4791

有一字串,包含

n個字元。寫一函式,將此字串中從第

m個字元開始的全部字元複製成為另乙個字串。

數字n

一行字串數字m從

m開始的子串

6

abcdef

3

cdef

主函式已給定如下,提交時不需要包含下述主函式

/* c++

***/

int main()

#include #include void strcpypos(char *str1,char *str2,int n);

using namespace std;

int main()

{ char s1[256],s2[256];

int n,pos,i;

cin>>n;

cin.get();

cin.getline(s1,n+1);

cin>>pos;

strcpypos(s2,s1,pos);

cout<

複製字串

time limit 1 sec memory limit 128 mb submit 164 solved 112 submit status web board 有一字串,包含n個字元。寫一函式,將此字串中從第m個字元開始的全部字元複製成為另乙個字串。數字n 一行字串數字m 從m開始的子串 6a...

複製字串2

author 劉慧豔 created edition v1.0 describe 複製字串str1,儲存到str2中 在字串str2後面增加符號 comment 將str1和str2接起來存放到str3中 將str1中的空格去除,仍儲存在str1中 將str1和str2接起來,仍存放在str1中 去...

複製字串3

author 劉慧豔 created edition v1.0 describe 複製字串str1,儲存到str2中 在字串str2後面增加符號 comment 將str1和str2接起來存放到str3中 將str1中的空格去除,仍儲存在str1中 將str1和str2接起來,仍存放在str1中 去...