I have an issue with some basic code I've been writing to learn C++. I've posted it here with comments. I'm using Code::Blocks, if that helps, and if the formatting doesn't come out right in the post, you should be able to copy and paste it to a maximized notepad file to get the formatting right. Otherwise, I'll attach a .txt file to this post. Take your pick.
//This is a nonsensical program for me to practice various aspects of the C++ Language. It should
//have a very simple conversation with the user. However, when I attempt to compile the program, I
//get several error messages stating (for example):
// "error: too few arguments to function 'void DayMessage(std::string, std::string)'"
//Please help me understand where I am going wrong, as I have looked over the code and cannot
//understand the errors. Thank you. Replies can be posted here or sent to firstname.lastname@example.org.
using namespace std;
//Just a simple function usage. Extraneous, I know, but my first self-created function.
cout<<"\n\nWell, hello there!\n\n";
//Not extraneous. Should get a carriage return to pass to void PrgmEnd()
string BreakCmd="a"; //Initializes BreakCmd to 'a' so that Return must be pressed.
cout<<"\n\n\nPlease press Return (Enter) to close.";
//First instance of the above stated error. Should pass BreakCmd to the function, and if matching,
//close down the program. Otherwise, it should repeat the prompt to press enter to close.
void PrgmEnd(string BreakCmd)
if (BreakCmd == "")//In other words, if Return (Enter) was pressed
//Should exit the function and return to main, ending the program and closing the window.
GetBreakCmd(); //Go back and repeat the prompt
//The next instance of the error. This function should test the string DayOfWeek, and output a
//message based on the input. Doesn't have an error catcher for entries that are not days of the
//week yet. Also likely has several other errors. Sorry, I know, but I was going to start debugging
//when I hit this snag.
void DayMessage (string DayOfWeek , string Name)
if (DayOfWeek == "Friday")
cout<<"\nIt's Friday? Yay! That means it's payday!\n\n";
else if (DayOfWeek == "Saturday" || DayOfWeek == "Sunday")
cout<<"\nAh, that's right! Payday was just here!\n\n";
cout<<"\nDarn! It's not Friday... I guess payday isn't here yet.\n\n";
cout<<"Anyway, "<<Name<<", I'm feeling pretty tired. I'm going to go to sleep now.\n\nGoodbye, "<<Name<<"!\n";
//Declares and initializes the two variables Name and DayOfWeek
//Executes that first simple function
//Prompt for the user's name
cout<<"\nWhat is your name?\n\n> ";
//Response and prompt for the day of the week
cout<<"\nHello, "<<Name<<"! What day is today?\n\n> ";
//Should rund DayMessage based on the entry for DayOfWeek
//Should prompt and get the program close sequence
//If program close sequence is executed, should finish out the main function and close the
//Returns a 0. I know there's probably a different way of doing this, but this is how I've
//learned so far. Any hints, tips, tricks, otherwise would be appreciated. I'm a greenhorn
//programmer and willing to learn if you're willing to offer advice.
//Thanks again for the help. Again, replies can be posted here or emailed to me at