how to create exe?

// Hasnain Attarwala

#include <iostream>
#include <string>



using namespace std;
// system prototype
void doYouHaveProblem();
void timePass();
// defining global variables
char ch;
char repeat = 'Y';


int main ()
{
timePass();
doYouHaveProblem();
return 0;
}


void timePass ()
{
cout << "Have you watched the movie lion king before? (ENTER Y/N)" << endl;
cin >> ch;


if (toupper(ch) == 'Y')
{
cout << "So you know what Hakuna Matata means!" << endl;
system("pause");
}
else
{
cout << "Hakuna Matata -- It means No Worries for the Rest of your Days!!!" << endl;
system("pause");
}
}


void doYouHaveProblem ()
{
do
{
system("cls");
cout << "Do you have a problem in your life? (ENTER Y/N)" << endl;
cin >> ch;
system("cls");

if (toupper(ch) == 'Y')
{
cout << "Can you do something about it? (ENTER Y/N)" << endl;
cin >> ch;
system("cls");
if (toupper(ch) == 'Y')
cout << "Then do it and don't worry about it -- \"HAKUNA MATATA\"" << endl;
else
cout << "Then dont worry about it -- \"HAKUNA MATATA\" " << endl;
}
else
cout << "Then dont worry about it -- \"HAKUNA MATATA\" "<< endl;
system("pause");
system("cls");

cout << "Any more questions sir? (ENTER Y/N)" << endl;
cin >> repeat;
system("cls");

}while(toupper(repeat) == 'Y');

}


This is my code, how do i create an exe file out of this?


also what does system("cls") do exactly? because in the timePass function if i put system("cls") after the IF but before the ELSE. And if the "if" statement gets executed, the else also gets executed after that automaticly.... Weird right?


I have the visual studio 2010 student edition, how do i create exe file out of my cpp?

I saw one of my friend's sad status on facebook and decided to make a small program for him, thought it would bring a small smile on his face, i want to send it to him.

To build it press: F7 to run it: ctrl F5
yes, but how do i create an exe file out of this?

Like i said i want to send it to my friend who does not have any compiler or knowledge on how to code....

ctrl f5 just runs it if you have a compiler...

and f7 builds it for the compiler, but not as an exe file.
Does it build to a different directory?

In the start menu, is there a command line compiler? On my computer, with VC Express, there is a program called "Visual Studio Command Prompt (2010)". Use that as a compiler, use the 'cd' command to navigate to the source file and use 'cl *.cpp" to compile the code.

Please use [code][/code] tags.
I mean, i can test it when i am writing the code in the visual studio compiler.

I want to create it as an ".exe" file
i wrote the program using visual studio, i know what danny toledo you are talking about.
Any C++ compiler create object file (.obj or .o) and executable file(.exe) file under windows at your .cpp files directory.Check file named yourprogramname.exe at build folder.
Yes, got it. Thanks Mazd.


btw, does someone know the answer to my first post, about the system("cls")?
Topic archived. No new replies allowed.