#include <stdio.h>
#include <math.h>
#include <memory.h>
#define LEN 1024
typedef struct _FuncVal
{
double x;
double y;
}FVAL;
int main(int argc, char* argv[])
{
FVAL* pFVal = new FVAL[LEN];
memset((void*)pFVal, 0x00, sizeof(FVAL) * LEN);
int d = 0;
while (d < LEN) { pFVal[d].x = -1; pFVal[d].y = -1; d++; }
int i = 0;
for (double x = -0.99; x <= 1; x+=0.01)
pFVal[i++].x = x;
for (int n = 0; pFVal[n].x != -1; n++)
pFVal[n].y = 10 * (1 + tanh(pFVal[n].x));
for (int t = 0; pFVal[t].x != -1; t++)
printf("x = %f y = %f\n",pFVal[t].x, pFVal[t].y);
int max = 0;
for (int k = 0; pFVal[k].x != -1; k++)
max = (((int)pFVal[k].y % 2) != 0 &&
pFVal[k].y > pFVal[max].y) ? k : max;
int count = 0;
for (int l = 0; pFVal[l].x != -1; l++)
if ((int)pFVal[l].y == (int)pFVal[max].y) count++;
printf("\nx = %f y = %f count = %d\n",pFVal[max].x, pFVal[max].y, count);
return 0;
}