Ok, so I'm very new to programming using ANY language. I have a question. I wrote a program to determine the surface area of a solid, and it works fine, but what do I do to be able to run the program without going through my compiler? To be more specific, I want to save it to a disk and be able to take it to a friend's computer and be able to run it even if they don't have a compiler. I'm sorry If this is very noobly, but I'm honestly very green when it comes to C++. PS If it helps, I'm using CodeBlocks IDE.
If you compiled your code in C++ it should compile to and "*.exe" file which can be run on other machines. Granted I am being generous with this statement all code wont run on all machines. So all you have to do is locate the "*.exe". Usually its what ever you named your program.
#include <cstdlib>
#include <iostream>
usingnamespace std;
int squareSurfaceArea( int side);
int main(int argc, char *argv[])
{
int userInput = 0;
cin >> userInput;
cout << "The Surface Area of a square is " << squareSurfaceArea( userInput) << endl;
system("PAUSE");
return EXIT_SUCCESS;
}
int squareSurfaceArea( int side)
{
return 6 * side * side;
}