:
__ __ ( __ )
{
/* , , .
, -
*/
// return -
// ()
//
return ;
}
__ ( ) , . , , .
, . , () .
, , , , .
__ - , return ; .
, , void. main.
, . . (), . .
__ ( __ )
__ , , . .
1.
countX, , , b , .
main a, , . countX, X
.
main cos sin, countX, .
|
|
, , countX , b , float. , float.
float
float b float
float c
countX :
float countX (float a, float b, float c)
countX . .
() math. h. , # include .
// example1.cpp
#include <math.h>
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;
}
, .
, (! LNK) .
Error 1 error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
Error 2 fatal error LNK1120: 1 unresolved externals
, main!!! main !
main 1 + 1 + 1 / 2,
1 countX, , b , c .
2 countX, , b , c .
pi. , , math. h
M_E | e | 2.71828182845904523536 |
M_LOG2E | log2(e) | 1.44269504088896340736 |
M_LOG10E | log10(e) | 0.434294481903251827651 |
M_LN2 | ln(2) | 0.693147180559945309417 |
M_LN10 | ln(10) | 2.30258509299404568402 |
M_PI | pi | 3.14159265358979323846 |
M_PI_2 | pi/2 | 1.57079632679489661923 |
M_PI_4 | pi/4 | 0.785398163397448309616 |
M_1_PI | 1/pi | 0.318309886183790671538 |
M_2_PI | 2/pi | 0.636619772367581343076 |
M_2_SQRTPI | 2/sqrt(pi) | 1.12837916709551257390 |
M_SQRT2 | sqrt(2) | 1.41421356237309504880 |
, , :
Define _USE_MATH_DEFINES
#include <math.h>
// example1.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)
{
float x;
x= (a * cos(b + c) - b * sin(a + c)) / (pow(a,3) + b * b);
return x;
|
|
}
void main (void)
{