Question: Here is my code: #include #include #include #include #include using namespace std; int main ( ) { / / TODO add code to solve Part
Here is my code:
#include
#include
#include
#include
#include
using namespace std;
int main
TODO add code to solve Part B Question
ifstream inputFileinputtxt;
if inputFile.isopen
cerr "There is an error opening this file" endl;
return ;
vector letters;
string line;
while getlineinputFile line
stringstream ssline;
string token;
while getliness token,
letters.pushbacktoken;
for int i letters.size; i ; i
if i
cout lettersi endl;
cout endl;
inputFile.close;
return ;
Here are my directions: Provide the code in main.cpp to solve the following problem:
You are given a file called input.txt that contains several lines of letterstokens delimited by a semicolon. Your task is to read and parse every line, placing each lettertoken in a vector called letters.
Once finished reading the file, print each letter that exists in an even positionindex within the vector, moving from the end of the list to the beginning of the list.
Example If the file contained this is in the textinput.txt file in Replit as well:
;;;;
The output you print should be:
Here is my current output that is incorrect:
l; ;x
a;x
h; ;k
e;e;x;s;; ;;s;;i;;h;
a;;H;r; ;x;;a;r;y;e;g;t
i;e;k;d;g;n;x;o;
;x;r;v;e;q;m;p
Can you help me avoid the skipped line before the last line of output and determine why this program is not sorting correctly.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
