sallam alikom , sorry but my computer doesn't support arabic letters
I have an assignment to find the first derivative of a function . . .
this is my work ,but I think I have a logic error since it compiled perfectly without errors
#ifndef f1_h #define f1_h double deriv(int x , double dx); #endif
#include "f1.h"
double deriv(int x ,double dx )
{
return (x+dx)-(x)/dx;
}#include <iostream>
#include "f1.h"
#include "f2.h"
using namespace std;
int main()
{
int x;
const double dx=0.000001;
cout<<"enter your function :\n";
cin>>x;
deriv( x , dx );
print( x , dx );
return 0;
}#ifndef f2_h #define f2_h void print(int x ,double dx); #endif
#include "f2.h"
#include <iostream>
using namespace std;
void print(int x ,double dx)
{
cout<<"f'(x) = "<<((x+dx)-(x))/dx<<endl;
}