Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. # include <iostream>
  2. # include <fstream>
  3. # include <sstream>
  4. # include <string>
  5. # include <istream>
  6. # include <stdio.h>
  7. # include <math.h>
  8. # include <stdlib.h>
  9.  
  10. using namespace std;
  11.  
  12. float funzi (float x) {
  13.  
  14. return (sin(x)+2);
  15.  
  16. int main();
  17. {
  18. float x,xp;
  19. float fprec;
  20. fprec = 0.01;
  21. cout<<"inserisci il valore iniziale di x"<<endl;
  22. cin>>x;
  23. do {
  24. xp=x;
  25. x=funzi (xp);
  26. cout<<x<<endl;
  27.  
  28. }
  29. while (fabs((x*xp)/xp)<fprec);
  30. cout<<x;
  31. cout<<"il valore di precisione รจ questo"<<endl;
  32. return (0);}
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement