Hello CoolAvocado,
does std::string filename is the same using #include <fstream> |
No. "std::string" is from the "<string>" header file and not to be confused with "<string.h>" which is a C header file for working with strings.
"<fstream>" is a header file for working with files.
"<iomanip>" is a header for working with input and output streams. Mainly "cout", "cin" along with an input or output file streams. "<iomanip>" allows you to use functions that manipulate the output and input. Mostly used for output. As I used
std::quoted(outFileName
this takes what is in the () and puts double quotes around it, as I used it, or it could be a quoted string, using double quotes, that is two or more characters. Do not worry too much just use what I showed you.
What you are most likely to use first from "<iomanip>" is:
std::cout << std::fixed << std::showpoint << std::setprecision(2);
. Where "fixed" says to use numbers not (scientific notation). The "showpoint" tells the output stream to print ".00" if it would show up. And "setprecision" says how many digits to the right of the decimal point to print. This is not needed for this program, but the code is worth keeping for the future.
For now I will just say that "setw()" is a way to line up the output to the screen or file.
As the comment says in the above code this line
std::this_thread::sleep_for(std::chrono::seconds(5));
is optional as is the header files "<chrono>" and "<thread>". You do not have to understand everything about these header files or the line of code. The only part you need to deal with is if it says "seconds" the number in the () is the whole number os seconds this will wait before continuing with the program. The other option is "milliseconds" where (1000) is equal to one second.
Hope that helps,
Andy