#include <stdio.h>
#include <math.h>
void prob1(void);
void prob2(void);
double func(double x);
double norm(double *v, int k);
main()
{
int menu;
printf("There are two functions: prob1() and prob2().\n");
printf("Enter the function number to execute (1 or 2):");
scanf("%d", &menu);
/* form a switch to execute one function */
switch(menu)
{
case 1:
prob1();
break;
case 2:
prob2();
break;
default:
printf("prob%d() does not exist.\n", menu);
}
exit(0);
}
/* Problem 1 */
void prob1(void)
{
double x;
printf("Here is Problem 1:\n");
printf("Enter a double f-p constant: ");
scanf("%lf",&x);
printf("f(%f) = %f\n", x, func(x));
return;
}
double func(double x)
{
if( x>= 4.0 ) return exp(x)-log10(x)+log(x);
if( x<=-3.0 ) return 6*x - sinh(x);
return x * sin(x) ;
}
/* Problem 2 */
void prob2(void)
{
double v[15];
int k;
printf("Here is Problem 2:\n");
printf("Enter the number of elements (<16): ");
do {
scanf("%d",&k);
} while (k > 15);
printf("Enter %d double f-p constants", k);
for( i=0; i<k; i++ )
}
return;
}
double norm(double *v, int k)
{
}