Ok I am writing a program that will read in 5 words using string list[5] and a for loop. Now I need to get it to output the 1st and 3rd letters in the words that were entered. I am having a bit of trouble and not sure what I am doing wrong. Am I supposed to use a do..while to accomplish this and if so can I please get an example are maybe some suggestions on what I might need. Thank you
Here is what I got so far...(reads 5 words but cant get it to display the certain letters wanted)
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
int main()
{
string list[5];
int counter;
for (counter = 0; counter < 5; counter++)
{
cout << "Enter five words: ";
cin >> list[counter];
}
cout << "The first and third letters in the entered words are: "
<< static_cast<unsigned char> (list[5].find(list[5], 1, 3))
<< endl;
cout << endl;
}