Theres类的这个函数 void split(char token,String *&,int& ntokens); 它应该根据给定的标记拆分字符串并将所有子串存储在作为第二个参数传递的动态数组中,并在第三个参数中返回ntokens。 不幸的是,我既不理解问题的描述,也不理解函数的参数。帮助将不胜感激。 注意:我们不允许使用cstring函数。 我尝试了什么: 我不明白这个问题,因此,没试过。
Theres this function of a String class void split(char token, String *&, int &ntokens); And it should should split the string according to given token and store all substrings in a dynamic array passed as second argument, and return ntokens in third argument. Unfortunately, I don't understand the problem neither the description given as well as well as the arguments of the function. Help would be appreciated. Note: We are not allowed to use cstring functions. What I have tried: I don't understand the problem, therefore, haven't tried it.
推荐答案您可以使用 strtok 开始实现您的功能[ ^ ]或编译器的任何适当版本,例如: strtok_s 函数参考页面底部有示例,可能有助于您了解如何使用它 you can begin implementing your function with strtok[^] or any appropriate version to your compiler , eg : strtok_s There is sample at the bottom of function reference page , that might help you to understand how to use it
更多推荐
令牌功能在字符串类中
发布评论