|
Compiling a Simple Program:
The best way to get started with HP aC++ is to write, compile, and execute a simple program,
like the following one:
#include <iostream.h>
int main()
{
int x,y;
cout << "Enter an integer: ";
cin >> x;
y = x * 2;
cout << "\n" << y <<" is twice " << x <<".\n";
}
If this program is in the file getting_started.C, compiling and linking the
program with the aCC command produces an executable file named a.out:
$ aCC getting_started.C
Executing the Program:
To run this executable file, just enter the name of the file.
The following summarizes this process with the file named getting_started.C:
$ a.out
Enter an integer: 7
14 is twice 7.
|