fork download
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. using namespace std;
  5.  
  6. double Virogenie(double x, int n) //value=znachenie
  7. {
  8. double Ans;
  9. int Schet;
  10. Ans = 0;
  11. for (Schet = 1; Schet <= n; Schet++)
  12. Ans += ((2 * Schet + 1) / (sin(Schet*x)))*pow(x, Schet - 1);
  13. return Ans;
  14. }
  15.  
  16.  
  17. void Virogenie(double *x, int *n, double *Ans) //pointer=ykazatel’
  18. {
  19. int Schet;
  20. *Ans = 0;
  21. for (Schet = 1; Schet <= *n; Schet++)
  22. *Ans += ((2 * Schet + 1) / (sin(Schet**x)))*pow(*x, Schet - 1);
  23. }
  24.  
  25. void Virogenie(double &x, int &n, double &Ans) //reference=ssylka
  26. {
  27. int Schet;
  28. Ans = 0;
  29. for (Schet = 1; Schet <= n; Schet++)
  30. Ans += ((2 * Schet + 1) / (sin(Schet*x)))*pow(x, Schet - 1);
  31. }
  32.  
  33. int main()
  34. {
  35. double Step, x, Ans, NachOts, KonOts;
  36. int n;
  37. cout << "Input a, b, h, n: \n";
  38. cin >> NachOts >> KonOts >> Step >> n;
  39.  
  40. cout << "\n\tValue" << setw(18) << "Pointer" << setw(23) << "Reference\n";
  41. x = NachOts;
  42.  
  43. do{
  44. cout << setw(5) << x << setw(10) << Virogenie(x, n);
  45.  
  46. Virogenie(&x, &n, &Ans);
  47. cout << setw(10) << x << setw(10) << Ans;
  48.  
  49. Virogenie(x, n, Ans);
  50. cout << setw(10) << x << setw(10) << Ans << endl;
  51.  
  52. x += Step;
  53. } while (x <= KonOts + Step / 2);
  54.  
  55. cout << endl;
  56. //system("pause");
  57. return 0;
  58. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:40:31: error: ‘setw’ was not declared in this scope
 cout << "\n\tValue" << setw(18) << "Pointer" << setw(23) << "Reference\n";
                               ^
stdout
Standard output is empty