Question
(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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started