|
Все страницы: |
1 2 | Посмотреть всю тему |
Vampyre - чё ты ржёшь???
.... - крутая у тебя подпезь ....
.
.
.
..
так: - кароче, вот к чему я пришёл -
моя прога:
// Polinom Lagranjia.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "math.h"
#include "conio.h"
float func(float x);
return 5/(1+2*x*x);
int _tmain(int argc, _TCHAR* argv[])
{
int i, j, k, n = 10, m = 50;
float a = -1, b = 1, x[100], f[100], dx = (b-a)/n, xx =4.5 , s, pr, proizv, fp=0, Ln, h;
for(i=0; i<=n; i++)
{
x[i] = a + dx*i;
for(i=0; i<=n; i++)
{
f[i] = func(x[i]);
h = (b-a)/m;
xx = a+h;
for(k=0; k<=m; k++)
{
for(i=0; i<=n; i++)
{
s=0;
proizv = 1;
for(j=0; j<=n; j++)
{
if(i!=j)
{
pr = (xx-x[j])/(x[i]-x[j]);
proizv = proizv*pr;
}
}
fp = f[i]*proizv;
s = s+fp;
}
Ln = s;
printf("\\n x = %5.3f", xx);
printf(" Real = %f", func(xx));
printf(" InterpL = %f", Ln);
xx = xx+h;
}
getch();
return 0;
}
а вот мои ошибки -
>>1) fatal error C1075: end of file found before the left brace '{' at 'c:\\documents and settings\\evil_maggot_666\\мои документы\\visual studio projects\\polinom lagranjia\\polinom lagranjia.cpp(21)' was matched
>>2) error C2059: syntax error : 'return'
такое ощущение - что всё из-за какого-нибудь знака препинания или запятая или скобка или хрен знает...
.... - крутая у тебя подпезь ....
.
.
.
..
так: - кароче, вот к чему я пришёл -
моя прога:
// Polinom Lagranjia.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "math.h"
#include "conio.h"
float func(float x);
return 5/(1+2*x*x);
int _tmain(int argc, _TCHAR* argv[])
{
int i, j, k, n = 10, m = 50;
float a = -1, b = 1, x[100], f[100], dx = (b-a)/n, xx =4.5 , s, pr, proizv, fp=0, Ln, h;
for(i=0; i<=n; i++)
{
x[i] = a + dx*i;
for(i=0; i<=n; i++)
{
f[i] = func(x[i]);
h = (b-a)/m;
xx = a+h;
for(k=0; k<=m; k++)
{
for(i=0; i<=n; i++)
{
s=0;
proizv = 1;
for(j=0; j<=n; j++)
{
if(i!=j)
{
pr = (xx-x[j])/(x[i]-x[j]);
proizv = proizv*pr;
}
}
fp = f[i]*proizv;
s = s+fp;
}
Ln = s;
printf("\\n x = %5.3f", xx);
printf(" Real = %f", func(xx));
printf(" InterpL = %f", Ln);
xx = xx+h;
}
getch();
return 0;
}
а вот мои ошибки -
>>1) fatal error C1075: end of file found before the left brace '{' at 'c:\\documents and settings\\evil_maggot_666\\мои документы\\visual studio projects\\polinom lagranjia\\polinom lagranjia.cpp(21)' was matched
>>2) error C2059: syntax error : 'return'
такое ощущение - что всё из-за какого-нибудь знака препинания или запятая или скобка или хрен знает...
|
Все страницы:
1
2
|



