Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(C++) Need to import the text from a notepad document including a space. I already have the program, but it is skipping spaces. here is

(C++) Need to import the text from a notepad document including a space. I already have the program, but it is skipping spaces. here is the program and input.

PROGRAM

#include

#include

#include

#include

#include

using namespace std;

ifstream in_stream;

string iarray[201];

int s = 0;

void readFromFile() {

in_stream.open("Input7.txt");

if (in_stream.fail()) {

cout << "failed to open. ";

exit(1);

}

while (!in_stream.eof()) {

in_stream >> iarray[s];

s++;

}

}

int main() {

readFromFile();

for (int i = 0; i < s; i=i++) {

cout << iarray[i];

}

return 0;

}

INPUT "Input7.txt"

Th is i s a se nt en ce .

CURRENT OUTPUT

Thisisasentence.

EXPECTED OUTPUT

This is a sentence.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

More Books

Students also viewed these Databases questions