home *** CD-ROM | disk | FTP | other *** search
- #include <fstream.h>
- #include <iostream.h>
- #include <stdio.h>
-
- extern "C" {
-
- #include <exec/types.h>
- #include <inline/exec.h>
- #include <clib/alib_protos.h>
-
- int atexit (void (*)(void));
-
- struct Library *MathTransBase;
- struct Library *MathBase;
- struct Library *MathIeeeDoubBasBase;
- struct Library *MathIeeeDoubTransBase;
- struct Library *UtilityBase;
- };
-
-
- void close_math(void)
- {
- struct Library *lib;
- if(MathBase) { lib=(Library *)MathBase; CloseLibrary(lib); }
- if(MathTransBase) { lib=(Library *)MathTransBase; CloseLibrary(lib); }
- if(MathIeeeDoubBasBase) { lib=(Library *)MathIeeeDoubBasBase; CloseLibrary(lib); }
- if(MathIeeeDoubTransBase) { lib=(Library *)MathIeeeDoubTransBase; CloseLibrary(lib); }
- if(UtilityBase) { lib=(Library *)UtilityBase; CloseLibrary(lib); }
- }
-
- BOOL init_math(void)
- {
- atexit(close_math);
-
- MathBase = OpenLibrary((STRPTR)"mathffp.library",0L);
- MathTransBase = OpenLibrary((STRPTR)"mathtrans.library",0L);
- MathIeeeDoubTransBase = OpenLibrary((STRPTR)"mathieeedoubtrans.library",0L);
- MathIeeeDoubBasBase = OpenLibrary((STRPTR)"mathieeedoubbas.library",0L);
- UtilityBase = OpenLibrary((STRPTR)"utility.library",0L);
-
- if(MathBase && MathTransBase && MathIeeeDoubTransBase && MathIeeeDoubBasBase && UtilityBase)
- return TRUE;
- else return FALSE;
- }
-
- int main(void)
- {
- if(init_math())
- {
- cout << "Hallo :" ;
- printf("Dies ist ein Test !! Bitte String eingeben:");
-
- char hallo[100];
-
- cin >> hallo;
-
- cout << hallo << endl;
- cout << hex << 100 << endl;
-
- cout << "Bitte float eingeben: ";
- float f;
- cin >> f;
- if(cin)
- cout << f << endl;
- else
- cout << "Ungültige Zahl !" << endl;
-
- cout << "Bitte double eingeben: ";
- double d;
- cin >>d;
-
- if(cin)
- {
- cout << d << endl;
-
- while(d)
- {
- cout << d << endl;
- d/=10.0;
- }
- }
- else
- cout << "Ungültige Zahl !" << endl;
-
- return 0;
- }
- else
- {
- printf("Not able to open all math-libraries !\n");
- return 20;
- }
- }
-