/*---- signature: main: void -> int purpose: a cheesy little program that asks the used to enter a word of the day and writes it to a file named word-of-the-day.txt in the current working directory compile using: g++ change_word.cpp -o change_word run using: ./change_word by: Sharon Tuttle last modified: 2022-09-08 ----*/ #include <cstdlib> #include <iostream> #include <string> #include <cmath> #include <fstream> // NEED for file input/output!! using namespace std; int main() { cout << boolalpha; // get a new word-of-the-day from the user string new_word; cout << "Please give today's new 5-letter word: "; cin >> new_word; // write it to word-of-the-day.txt, // OVERWRITING its current contents const string WORD_FILE = "word-of-the-day.txt"; ofstream write_stream; write_stream.open(WORD_FILE); write_stream << new_word << endl; write_stream.close(); cout << ("\nFile " + WORD_FILE + " should now contain: " + new_word) << endl; return EXIT_SUCCESS; }