I don't know a way to enter string into a vector.
For example, there is string s = "augcuuaucaca" and I want to separate the string s into groups of 3 characters such as "aug", "cuu", "auc", "aca" and each group of characters would be string type.
After that, I would store "aug" into vector[0], "cuu" into vector[1], etc...
So each element of vector would have a 3 character group.
I tried many different ways but I can't seem to find the solution. I need help how to solve this.
Below are some of my attemps to solve this the problem.
cout << s << endl;
for (int i=0; i < s.length() - 2; i+3)
{
char temp[3];
cin.get (temp, 3);
codons.push_back (temp);
cout << "The codons: " << codons[i] << endl;
}
vector<char> codons;
for (int i=0; i < dnaStrand.length() - 2; i+3)
{
char temp[] = { dnaStrand[i], dnaStrand[i+1], dnaStrand[i+2] };
codons.push_back (temp);
}
vector<string> codons;
for (int i=0; i < dnaStrand.length() - 2; i+3)
{
char temp[] = { dnaStrand[i], dnaStrand[i+1], dnaStrand[i+2] };
codons.push_back (temp);
}