#include <stdio.h>;
void getInput(float*,int*);
float sinHyper(float,int);
void reset(float*,int*,char*);

void main(){
    float SIN;
    float realV; float* realPTR = &realV;
    int numTerms; int* numPTR = &numTerms;
    char yesNo; char* yesPTR = yesNo;
    do{
        printf("\n");
        getInput(&*realPTR,&*numPTR);
        SIN = sinHyper(realV,numTerms);
        printf("sinh(%f) is ",realV); printf("%g\n",SIN);
        do{
            printf("Do you wish to quit (y/n): "); fflush(stdin);
            scanf("%c", &yesNo);
        }while(!(yesNo == 'n' || yesNo == 'y'));
    }while(yesNo == 'n');
    printf("Program Terminated\n");
}

void getInput(float* real, int* num){
    //Getting REAL
    printf("Please enter a real value for x: ");
    scanf("%f",&*real);
    //Getting NUMBERS OR TERMS
    do{
        printf("How many terms to use: ");
        scanf("%d",&*num);
        if(*num <= 0)
            printf("The number of terms has to be greater than 0\n");
    }while (*num <= 0);
}
float sinHyper(float Real,int Terms){
    int count; float prevSIN = Real; float totalSin = 0;
    for(count = 0; count < Terms; count = count + 1){
        if(count != 0)
            prevSIN = (prevSIN*(Real*Real))/((2*count+1)*(2*count));
        totalSin = totalSin + prevSIN;
    }
    return totalSin;
}
