C,C++通用代码,用C的习惯用法
纯粹C++用C++的习惯用法
C:(C,C++ 通用)
C++:
纯粹C++用C++的习惯用法
C:(C,C++ 通用)
1
2
3
4
|
1)
#define PI 3.14
2)
enum
{ red,green,blue };
|
C++:
1
2
3
4
5
6
7
8
9
10
11
12
13
|
const
double
pi =3.14;
const
int
black =0;
class
Color{
union
{
unsigned
int
color;
struct
{
unsigned
char
r,g,b,a;
}
unsigned carr[4];
};
static
const
int
black = 0;
};
|