File: sample.c

package info (click to toggle)
saclib 2.2.8-6.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,872 kB
  • sloc: ansic: 40,932; csh: 1,190; asm: 541; awk: 320; sh: 246; perl: 116; makefile: 98; sed: 48
file content (32 lines) | stat: -rw-r--r-- 857 bytes parent folder | download | duplicates (5)
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
26
27
28
29
30
31
32
/*============================================
    Sample program calling SACLIB
  =============================================*/

#include "saclib.h"

int sacMain(argc, argv)
        int argc;
        char **argv;
{
        Word    I1,I2,I3,t;
        Word    i,n;

Step1:  /* Input. */
        SWRITE("Please enter the first integer: "); I1 = IREAD();
        SWRITE("Please enter the second integer: "); I2 = IREAD();
        SWRITE("How many iterations? "); n = GREAD();

Step2:  /* Processing. */
        t = CLOCK();
        for (i=0; i<n; i++)
          I3 = IPROD(I1,I2);
        t = CLOCK() - t;

Step3:  /* Output. */
        IWRITE(I1); SWRITE(" * "); IWRITE(I2); SWRITE(" =\n"); IWRITE(I3);
        SWRITE("\nRepeating the above computation "); GWRITE(n);
	SWRITE(" times took\n"); GWRITE(t); SWRITE(" milliseconds.\n");

Return:
	return(0);
}