Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In the example above, the user input is copied into a char array, which is different than a string type in C++.  Thus, strings and standard input are slightly different in C++.  In the other examples of reading files, they are read character by character to eliminate the need to deal with the string vs char array challenge when reading in the file.  Since char is a basic type in C++ is can very simply be outputted to the terminal.  

Image AddedImage AddedImage AddedImage Added

And the output of writing to a text file:

Image Added

Is:

Image Added

Task 2: Functions

Functions in C++ need to have a return type in its function declaration.  For example, this returns an int:

...