My favorites
▼
|
Sign in
nmcalc
projekt na inzynierie oprogramowania
Project Home
Downloads
Wiki
Issues
Source
READ-ONLY: This project has been
archived
. For more information see
this post
.
Search
Search within:
All issues
Open issues
New issues
Issues to verify
for
Advanced search
Search tips
Subscriptions
Issue
3
attachment: hpc.txt
(920 bytes)
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
#include <cstdlib>
#include <iostream>
using namespace std;
double abs(double x){
if(x < 0)
return x*(-1);
else
return x;
}
double fr(double x, double y)
{
//double f = 10 - x*x +y;
//return (2*x + y*y*x);
return (2 * x * y);
}
//=================================================================================
int main(int argc, char *argv[])
{
double y = 0;
double H = 0.1;
int ilosc = 2;
double x0 = 0;
double y0 = 1;
y=y0;
double x;
double c, p; //predicotr i corrector
for (int i=0; i<ilosc; i++)
{
x=x0+(i*H);
p = y + (H * ( fr(x,y) ));
c = y + (H * ( (fr(x,y) + fr((x + H), p))/2));
//y0=y;
y=c;
//x0=x;
cout << "P: " << p << " C: " << c <<endl;
};
system("PAUSE");
return EXIT_SUCCESS;
}
Powered by
Google Project Hosting