我想我只是没学过。我以前从未做过。我已经看到了strcat(S1, S2)
的用法,但这在这里不适用,是吗?
我可以做类似的事情吗
string all_possible_strings[10];
char jumbled_chars[] = "ABCDEFG";
all_possible_strings[1] = jumbled_chars[0] << jumbled_chars[1]
<< jumbled_chars[2] << jumbled_chars[3]
<< jumbled_chars[4];
我想做的是制作一个程序,可以将单词理解为所有可能的排列。
最佳答案
#include <iostream>
#include <string>
using namespace std;
int main()
{
string theString = "";
char a = 'a';
char b = 'b';
const char* c = "cdefghijklmnopqrstuvwxyz";
theString += a;
theString += b;
theString += c;
cout << theString;
return 0;
}
那会打印出整个字母。
关于c++ - 我如何才能将许多字符放入一个字符串中,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8250525/