Using A Program

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.
Last edited on

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.

If that doesn't help maybe this will.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

#include <cstdlib>
#include <iostream>

using namespace 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;
}





Last edited on
Thank you very much. I got it to work. This is my first practical program and really means a lot.
Last edited on
its cool, i am a new gauy, this prog also does mean a lot for me.
Topic archived. No new replies allowed.