Sunday 2 October 2011

A++ Hello World Example

#include <A++.h>   // this is included in every A++/P++ application
int main(int argc,char** argv) 
{ 
// We are instancing the doubleArray object.  Though it looks like a
// standard Fortran array, it's not  
doubleArray A(10); 
doubleArray B(10); 

// Initialize A and B 
A=2;  
B=3; 

Illustration of the methods associated with doubleArray Objects
``display'' is used to show the values of the Object 

A.display(``This is the doubleArray Object A''); 
B.display(``This is the doubleArray Object B'') 

// We can add to array objects with the ``+'' operator 
A=A+B; 
A.display(``Addition of A and B'');
}

No comments:

Post a Comment