我有一個字符串,我需要從開始處繼續減去字母,並且字母連續移動。例如:在字符串的開始處減去
ABC DEF GHI JK需要像這樣 BCD EFG HIJ K和再 CDE FGH IJK
我有一些代碼,但字母不單獨移動:
int main()
{
string code, default_Code;
default_Code = "TCAATGTAACGCGCTACCCGGAGCTCTGGGCCCAAATTTCATCCACT";
start_C = "AUG";
code.reserve(100);
int i = 0, a = 0, c =0;
char choice;
for (int j = 3; j < code.length(); j += 4) // Creating space between 3 letters
{
code.insert(j, 1, ' ');
}
do {
i = 0;
do { // Looping to create an open reading frame.
for (int b = 0; b*3 < code.length(); b++) { // moving through the code
for (int a = 0; a < 3; a++) {
cout << code[(a + b*3) + i];
}
}
i++;
cout << endl;
} while (i < 3);
reverse(code.rbegin(), code.rend()); // Reversing to create the second set reading frame.
c++;
cout << endl;
} while (c < 2);
return 0;
}
試圖清理格式化一下。 –