输入我的符号后,我想打印一个子词。比如像这样。
我要输入abcdefghijk d
并得到efghijk
这是我的无条件代码体。
#include <iostream>
int main(){
const int n = 21;
char word[n];
std::cin>>word;
char symbol;
std::cin>>symbol;
int i = 0;
char*p = word;
while(word[i]!='\0' && word[i]!=symbol){
// what condition I need to write here?
i++;
std::cout << p <<std::endl;
}
return 0;
}
感谢您的帮助))