![]() |
|
|
Регистрация Восстановить пароль |
Регистрация | Задать вопрос |
Заплачу за решение |
Новые сообщения |
Сообщения за день |
Расширенный поиск |
Правила |
Всё прочитано |
![]() |
|
Опции темы | Поиск в этой теме |
![]() |
#1 |
Пользователь
Регистрация: 19.09.2009
Сообщений: 20
|
![]()
Есть код на С++, приведенный ниже, при компиляции пишет : Undefined symbol 'S', Multiple declaration for 'i'
#include <iostream> #include <math.h> using namespace std; double deg (double grad); int integer (double a); int main() { double n2 = 10; double m2 = 10; double h = 0.01; double n1 = n2/h; double m1 = m2/h; int m = integer(m1); int n = integer(n1); int S[m][n]; double x0; double y0; double z0; double x1; double y1; double x2; double y2; double xc; double yc; double fi1; double psi1; double al1; double d = 0; double l = 0; for (double i = 0; i < m1; i+=h) { for (double j = 0; j < n1; j+=h) { S[i][j] = 0; } } cout << "Vvedite x0, y0, z0, fi (grad), psi, al" << endl; cin >> x0; cin >> y0; cin >> z0; cin >> fi1; double fi = deg(fi1); cin >> psi1; double psi = deg(psi1); cin >> al1; double al = deg(al1); if (fi/2 > al) { d = z0*tan(fi/2-al); l = z0*tan(fi/2+al)+d; for (double i=0; i<=n1; i+=h) { double j = y0 - (x0-i)*tan(psi); double t1 = pow((x0-i), 2) + pow((y0-j), 2); double t2 = pow(t1, 0.5); if ((fabs(t2-d))<h) { x1 = i; y1 = j; x2 = x1 + l*cos(psi); y2 = y1 + l*sin(psi); xc = (x1 + x2)/2; yc = (y1 + y2)/2; } } } if (fi/2 < al) { double d = z0*tan(al-fi/2); double l = z0*tan(fi/2+al); for (double i=0; i<=n1; i+=h) { double j = y0 - (x0-i)*tan(psi); double t1 = pow((x0-i), 2) + pow((y0-j), 2); double t2 = (t1, 0.5); if ((fabs(t2-d))<h) { x1 = i; y1 = j; x2 = x1 + l*cos(psi); y2 = y1 + l*sin(psi); xc = (x1 + x2)/2; yc = (y1 + y2)/2; } } } cout << d << " " << l <<endl; cout << x1 << " " << y1 <<endl; cout << x2 << " " << y2 <<endl; cout << xc << " " << yc <<endl; double xmin = xc - l; double xmax = xc + l; double ymin = yc - l; double ymax = yc + l; double a = pow((pow((x2-x1),2))+(pow((y2-y1),2)),0.5); //Bolshaya poluis' ellipsa - rasstoyanie mejdu (x1,y1) i (x2,y2) double b = z0*tan(fi/2)/cos(al); cout << a << " " << b; int deltax = (xmax - xmin)/h; int deltay = (ymax - ymin)/h; for (int i = 0; i <= m; i++) / { for (int j = 0; j <= n; j++) { double k = pow(i,2)/pow(a,2) + pow(j,2)/pow(b,2) - 2*i*j*sin(psi)/a/b - pow((cos(psi)),2); if (k <= 0) { S[i][j] = 1; } } } return 0; } double deg(double grad) { double d = 6.28*grad/360; return d; } int integer(double a) { int k = 0; while (a > k) { int p = a - k; k++; } return k; } |
![]() |
![]() |
![]() |
![]() |
||||
Тема | Автор | Раздел | Ответов | Последнее сообщение |
Ошибка при компиляции | 7B! | Общие вопросы .NET | 7 | 08.01.2010 13:11 |
Ошибка при компиляции | haste39 | Общие вопросы C/C++ | 4 | 13.11.2009 00:24 |
Ошибка при компиляции | CrazyRabbit | Общие вопросы C/C++ | 3 | 25.12.2008 18:41 |
Ошибка при компиляции | [QY]'~''LeK1[ee] | Помощь студентам | 2 | 28.05.2008 20:46 |