问题描述
我必须创建一个从用户读取行字符串的代码,并在有空格时存储该字符串,然后使用此输入执行某些操作。
例如输入可以是那样的:
设置11643133名称Alex Jon
这一切都必须输入一行,我必须划分它为学生的ID11643136设置名称Alex Jon
我真的必须把项目交给最近的时间,我只是想问一下是否有简单的方法或某些标准命令可能对我有帮助吗?
*我使用getstr()和string。 substr()
我的尝试:
I have to make a code that read a line strings from user and divides this string when there is a space, store and then do some operations with this input.
For example the input can be like That :
"set 11643133 name Alex Jon"
all this it have to be input in a one line, and I have to divide it for set a name "Alex Jon" to the student's ID "11643136"
I really have to hand the project in nearest time, I just want to ask if there is a simple way or some standard commands maybe can it helps me at that ?
*I use getstr() and string.substr()
What I have tried:
getstr();
string.substr;
推荐答案
这篇关于C ++中的字符串行命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!