Unseen function

I have a function findSum in my code, but my compilator neither sees it, nor outputs it.
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#include <iostream>
#include <cstdlib>
#include "math.h"
using namespace std;
double findX(double x, double a, double b, double h)
{
        for(x = a; x<=b; x+=h)
        {
               cout<<"x = "<<x<<" "<<endl;
        }
    return x;
}
double findY(double x, double a, double b, double h, double n, double y)
    {
        for(x = a; x<=b; x+=h)
        {
        y=pow(exp(x),2*x);
        cout<<"Y = "<<y<<" "<<endl;
        }
        return y;
    }
        
double findSum(double x, double sum, int r, int k, double a, double b, double h, double n)
        {
                for(x = a; x<=b; x+=h)
                {
                    r = sum = 1;
                    for(k = 1; k<=n; k++)
                    {
                        r=2*r*x/k;
                        sum+=r;
                        cout<< "Sum = "<<sum<<" "<<endl;
                    }
                }
            return sum;
        }
double findMod(double x, double sum, int r, int k, double a, double b, double h, double n, double mod, double y)
    {
        for(x = a; x<=b; x+=h)
        {
            r = sum = 1;
            for(k = 1; k<=n; k++)
            {
                r=2*r*x/k;
                sum+=r;
                y=pow(exp(x),2*x);
                {
                      mod=fabs(y-sum);
                      cout<<"|Y(x)-Sum(x)| = "<<mod<<" "<<endl;
                }
            }
        }
        return mod;
    }
int main()
{
    double a, b, x, h, r = 1, sum = 1, y, mod;
    int n, k;
    cout<<"Input a = ";
    cin>>a;
    cout<<"Input b = ";
    cin>>b;
    cout<<"Input h = ";
    cin>>h;
    cout<<"Input n = ";
    cin>>n;
    cout<<endl;
    x = findX (x, a, b, h);
    y = findY (x, a, b, h, n, y);
    sum = findSum ( x, r, k, a, b, h, n, sum);
    mod = findMod (x, sum, r, k, a, b, h, n, y, mod);
    system ("pause");
}
What is the exact compiler error that tells you that the function is not seen by the compiler?
its <cmath> not "math.h". This is a minor detail, but try to use this version.

your program compiled and ran, producing results, for me. You may have forgotten to save before you compiled, or you may need to clean / rebuild instead of flat compile.
Hello Yana111,

What keskiverto said. Other than some warnings about converting a double to an int and errors about uninitialized variables the program compiled and ran fine for me.

You should always initialize your variables.

Andy
Topic archived. No new replies allowed.