i have an array with 6 slots. each slot has a word in it.how do i go about Using a do while() loop to print out the 1st and 3rd letters of each word (two letters per line) using the substring function
How are words represented in your program? If you do it using std::string it's piece of cake. You don't have to use any substring function, just the [] operator.
Use a for loop to get each word of your strArray. Then use the [] operator of the string to get the first and third character (yes, strArray[i][j] is valid syntax).
the assignment is to use a do while loop. i am not asking for the code as this is a homework assignment but i just need the sytax for it. my teacher sent me to a site that explains extracting from a string but this is an array.
this is the assignment
Next, add code to read 5 words from the Console (user input). Store these values into an array of string []. Make sure the string[] array is large enough to hold at least 6 values. Store the string constant “end_of_array” into the last element of the array. Using a do…while() loop, print out the 1st and 3rd letters of each word (two letters per line) using the substring function.
everything i have read tells how to get the charactors i need from a string but not from an array