home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 11 / FM Towns Free Software Collection 11.iso / t_os / lib / objcol2 / sample / test7.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-08-12  |  1.0 KB  |  55 lines

  1. /* Sample of "value.o", linked with value.o strin.o vircon.o symbol.o
  2.                                                     By SAKU        */
  3. #include <stdio.h>
  4. #include <string.h>
  5. #include <math.h>
  6. #include <egb.h>
  7. #include "strin.h"
  8. #include "value.h"
  9. #include "vircon.h"
  10.  
  11. #define    NOERR    0
  12. #define    ERR        1
  13.  
  14. char    egbwork[1536];
  15.  
  16. int        main()
  17. {
  18.     char    str[256];
  19.     double    a;
  20.     char    buf[256];
  21.  
  22.     EGB_init( egbwork, 1536 );
  23.     EGB_resolution( egbwork, 1, 3 );
  24.     EGB_writePage( egbwork, 1 );
  25.     EGB_displayPage( egbwork, 0, 3 );
  26.     VC_init( egbwork, 0, 240, 60, 8, 15, 1 );
  27.  
  28.     ST_locate( 0, 0 );
  29.     while(1)
  30.     {
  31.         switch( ST_inputStrings( egbwork, str, 256, "計算式を入力して下さい" ) )
  32.         {
  33.             case -3:
  34.             case 0:
  35.                 VC_printf( "input abort!\n" );
  36.                 return ERR;
  37.         }
  38.  
  39.         VC_printf( "%s = ", POINTER, str );
  40.  
  41.         if( calcvalue( str, &a ) )
  42.         {
  43.             VC_printf( "error!\n" );
  44.             return ERR;
  45.         }
  46.         sprintf( buf, "%g\n", a );
  47.         VC_printf( "%s", POINTER, buf );
  48.     }
  49.  
  50.     EGB_writePage( egbwork, 0 );
  51.     screenterm( egbwork );
  52.  
  53.     return NOERR;
  54. }
  55.