() -.
, , , . , , .
, , , , , . { }.
. , , . , .
, , . , .
, , , . , , : countX, main.
// example1.cpp countX, main
Define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <conio.h>
using namespace std;
float countX (float a, float b, float c)
{
float x;
x= (a * cos(b + c) - b * sin(a + c)) / (pow(a,3) + b * b);
return x;
}
// --
void main (void)
{
out << endl << "vvedite a, x1, x2 ";
float x1, a, x2;
cin>>a>>x1>>x2;
float vir1;
vir1 = countX (x1*x1, x2, M_PI_2); // countX
float vir2;
vir2 = countX (x2, x1 + 1.2, 0); // countX
float x = 1./11 + a * vir1 + 1 / vir2;
cout << endl << "X = " << x;
getch();
}
// --
countX ( ).
. , countX, .
, example2.cpp. countX , .
// example2.cpp
// , main
Define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <conio.h>
using namespace std;
void main (void)
{
out << endl << "vvedite a, x1, x2 ";
float x1, a, x2;
cin>>a>>x1>>x2;
float vir1;
vir 1 = countX (x 1* x 1, x 2, M _ PI _2); // countX !
|
|
float vir2;
vir 2 = countX (x 2, x 1 + 1.2, 0); // countX !
float x = 1./11 + a * vir 1 + 1 / vir 2;
cout << endl << "X = " << x;
getch();
}
float countX (float a, float b, float c)
{
float x;
x= (a * cos(b + c) - b * sin(a + c)) / (pow(a,3) + b * b);
return x;
}
countX
:
List Error
Error 2 error C3861: 'countX': identifier not found \2\example2.cpp 15
Error 3 error C3861: 'countX': identifier not found \2\example2.cpp 16
, , countX?
, , .
( ) , ( !):
float countX (float a, float b, float c);
( -) main, , .
// example2.cpp
// , main
Define _USE_MATH_DEFINES
#include <math.h>
#include <iostream>
#include <conio.h>
using namespace std;
float countX (float a, float b, float c);
void main (void)
{
out << endl << "vvedite a, x1, x2 ";
float x1, a, x2;
cin>>a>>x1>>x2;
float vir1;
vir1 = countX (x1*x1, x2, M_PI_2); // countX !
float vir2;
vir 2 = countX (x 2, x 1 + 1.2, 0); // countX !
float x = 1./11 + a * vir1 + 1 / vir2;
cout << endl << "X = " << x;
getch();
}