// PROGRAM tasks // illustrate use of subroutines #include "TrueBASIC.h" int main(); void initial(double *x, double *y); void add(double x, double y, double *sum); void multiply(double x, double y, double *product); int main() { double product, sum, x, y; // note how variables are passed initial(&x, &y); // initialize variables add(x, y, &sum); // add two variables multiply(x, y, &product); printf("sum = %f product = %f\n", sum, product); return 0; } // end of main program void initial(double *x, double *y) { char Stmp1_[_LBUFF_]; printf("? "); fgets(Stmp1_, _LBUFF_, stdin); sscanf(Stmp1_, "%lg", x); printf("? "); fgets(Stmp1_, _LBUFF_, stdin); sscanf(Stmp1_, "%lg", y); } void add(double x, double y, double *sum) { (*sum) = x + y; } void multiply(double x, double y, double *product) { (*product) = x*y; }