c++中如何提取出一个字符串中的几个字符?
2个回答
展开全部
#include <stdio.h>
void main()
{
char *str = "abdese";
char e = str[3];
printf("%c", e);
}
字符串可以当数组用。
void main()
{
char *str = "abdese";
char e = str[3];
printf("%c", e);
}
字符串可以当数组用。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
string str="abdese";
char ch = str[3];
string s("What we have here is a failure to communicate");
string sub = s.substr(21);
cout << "The original string is " << s << endl;
cout << "The substring is " << sub << endl;
displays
The original string is What we have here is a failure to communicate
The substring is a failure to communicate
char ch = str[3];
string s("What we have here is a failure to communicate");
string sub = s.substr(21);
cout << "The original string is " << s << endl;
cout << "The substring is " << sub << endl;
displays
The original string is What we have here is a failure to communicate
The substring is a failure to communicate
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询