一级日韩免费大片,亚洲一区二区三区高清,性欧美乱妇高清come,久久婷婷国产麻豆91天堂,亚洲av无码a片在线观看

付出與收獲初三作文

時(shí)間:2025-10-24 01:34:40 收獲 我要投稿

付出與收獲初三作文

  題目描述:

付出與收獲初三作文

  通過(guò)鍵盤(pán)輸入任意一個(gè)字符串序列,字符串可能包含多個(gè)子串,子串以空格分隔。請編寫(xiě)一

  個(gè)程序,自動(dòng)分離出各個(gè)子串,并使用’,’將其分隔,并且在最后也補充一個(gè)’,’并將子

  串存儲。

  如果輸入“abc def gh i d”,結果將是abc,def,gh,i,d,

  要求實(shí)現函數:

  void DivideString(const char *pInputStr, long lInputLen, char *pOutputStr);

  【輸入】 pInputStr: 輸入字符串

  lInputLen: 輸入字符串長(cháng)度

  【輸出】 pOutputStr: 輸出字符串,空間已經(jīng)開(kāi)辟好,與輸入字符串等長(cháng);

  【注意】只需要完成該函數功能算法,中間不需要有任何IO 的輸入輸出

  示例

  輸入:“abc def gh i d”

  輸出:“abc,def,gh,i,d,”

  參考答案:

  #include

  #include

  #define NULL 0

  #define ERROR 0

  void DivideString(const char *pInputStr,long inputLen,char *pOutputStr)

  {

  int i=0,j=0;

  for(i=0,j=0;i

  {

  if(pInputStr[i]!=' ')

  pOutputStr[j]=pInputStr[i];

  else

  {

  pOutputStr[j]=',';

  i++;

  while(pInputStr[i]==' ')

  i++;

  i--;

  }

  }

  pOutputStr[j]=',';

  pOutputStr[++j]='\0';

  }

  int main()

  {

  char *pInputStr;

  char *pOutputStr;

  int inputLen=13;

  pInputStr=(char*)malloc(inputLen*sizeof(char));

  pInputStr="abc def ghi d";

  if(pInputStr==NULL)

  return ERROR;

  pOutputStr=(char*)malloc((inputLen+1)*sizeof(char));

  if(pOutputStr==NULL)

  return ERROR;

  DivideString(pInputStr,inputLen,pOutputStr);

  cout<

  }

  }

  題目二:逆序鏈表輸出。

  題目描述:

  將輸入的一個(gè)單向鏈表,逆序后輸出鏈表中的值。鏈表定義如下:

  typedef struct tagListNode

  {

  int value;

  struct tagListNode *next;

  }ListNode;

  要求實(shí)現函數:

  void converse(ListNode **head);

  【輸入】head: 鏈表頭節點(diǎn),空間已經(jīng)開(kāi)辟好

  【輸出】head: 逆序后的鏈表頭節點(diǎn)

  【返回】無(wú)

  【注意】只需要完成該函數功能算法,中間不需要有任何IO 的輸入輸出

【付出與收獲初三作文】相關(guān)文章:

付出收獲作文05-30

(經(jīng)典)付出與收獲作文10-29

付出的收獲作文02-19

收獲與付出作文05-26

付出與收獲作文07-07

付出與收獲作文07-13

付出與收獲作文初中06-02

(通用)付出與收獲作文02-15

【優(yōu)選】付出與收獲作文07-16

【合集】付出收獲作文07-26

一级日韩免费大片,亚洲一区二区三区高清,性欧美乱妇高清come,久久婷婷国产麻豆91天堂,亚洲av无码a片在线观看