int main()
{
char string1[1000] = ""; // Have to initialize the strings with equal sign and quotation marks
char string2[1000] = "";
char string3[1000] = "";
char concatenatedString[3000] = "";
// ask the user to input 3 strings
cout << "Enter 3 strings" << endl;
cin.getline(string1, 1000);
cin.getline(string2, 1000);
cin.getline(string3, 1000);
// concatenate them into 1 string
strcat_s(concatenatedString, string1);
strcat_s(concatenatedString, string2);
strcat_s(concatenatedString, string3);
// display the concatenated string
cout << " The concatenated string is " << concatenatedString << endl;
// display the length of each input string
cout << "string1 length is " << strlen(string1) << endl;
cout << "string2 length is " << strlen(string2) << endl;
cout << "string3 length is " << strlen(string3) << endl;
PLEASE ALWAYS USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your post. http://www.cplusplus.com/articles/jEywvCM9/ http://www.cplusplus.com/articles/z13hAqkS/
Hint: You can edit your post, highlight your code and press the <> formatting button.
You can use the preview button at the bottom to see how it looks.
Just loaded up your program to what is happening and ran into a problem with "_TCHAR". Not sure where that is defined, which header file, but I do know that it is not working for me right now.
"_tmain" may work for a windows program, maybe, but not for straight C++ program. Also I see no use of "agrc" or "argv" in your main file. If you are nor going to use them they are not need. a simple int main() will work.
Just a suggestion here. I would put the menu in its own function returning the users choice. Inside this function after displaying the menu get the users choice and verify that it is valid before ending say a do/while loop and returning a usable choice.
After that I am not sure what you are looking for here. You have posted code, but no real question/ Do not make people guess at what you need or you may be waiting for a long time.
#include <iostream>
//using namespace std; // <--- Best not to use, but if you feel that you have to it should be first;
//declerations for 5 functions called from the menu
void Chicken();
void Fish();
void PrimeRib();
void Steak();
void Vegeterian();
int MainMenu();
int main()
{
int selection = 0;
bool done = false;
while (!done)
{
// while statement that repeat selections for menu
selection = MainMenu();
// rest of code here
return 0;
}