勇敢追求自己,加油加油
分类: C/C++
2010-12-01 20:11:03
//***********************************************
#include
}
//******************************************
#include
using namespace std;
union variant
{
int ival;
float fval;
double dval;
};
union variant s={5};
int main()
{
union variant *p=&s;
cout<<"s.ival= "<
}
//******************************************
#include
using namespace std;
union variant
{
int ival;
float fval;
double dval;
};
union variant s1={5};
int main()
{
union variant *p=&s1;
union variant s2;
s2=s1;
cout<<"p->ival= "<
}
//*******************************************
#include
using namespace std;
#include
struct test
{
char name[10];
float score;
};
void print_score(test &pn)
{
cout<
int main()
{
test a[2]={{"张三",88.5f},{"li_si",98.6F}};
int num=sizeof(a)/sizeof(test);
for(int i=0;i
print_score(a[i]);
}
return 0;
}
//***********************************************
//******************************************
#include
using namespace std;
int main()
{
enum Direction1{up1,down1,before1,back1,left1,right1};
enum Direction1 first;
cout<<"first Direction is defined"<
cout<<"second Direction is defined"<
}
//********************************************
#include
using namespace std;
int main()
{
int i=1;
cout<<"i="< return 0;
}
//*****************************************
#include
using namespace std;
typedef int COUNT;
typedef double AREA;
typedef struct
{
double x;
double y;
double z;
}Point;
typedef char * STRING;
int main()
{
COUNT a=100;
cout<<"a= "< AREA b=50.02;
cout<<"b= "< Point op={1.0,2.0,3.0};
cout<<"op.x= "<
cout<<"csName= "<
}
//****************************************
#include
using namespace std;
struct bs
{
unsigned a:1;
unsigned b:3;
unsigned c:4;
}bit,*pbit;
int main()
{
bit.a=1;
bit.b=7;
bit.c=15;
cout<<"bit.a= "<
pbit=&bit;
pbit->a=0;
pbit->b&=3;
pbit->c|=1;
cout<
}
//************************************
#include
using namespace std;
enum COLORS
{
BLACK,BLUE,GREEN,CYAN,RED,MAGENTA,BROWN,
LITHTGRAY,DARKGRAY,LIGHTBLUE,LIGHTGREEN,
LIGHTCYAN,LIGHTRED,LIGHTMAGENTA,YELLOW,
WHITE};
int main()
{
enum COLORS a,b,c;
enum COLORS *pa;
int d=2;
a=RED;
b=WHITE;
c=BLACK;
cout<<"a= "< cout<<"b= "< cout<<"c= "<
if(a>b)
pa=&a;
else
pa=&b;
cout<<"*pa= "<<*pa<
}
//**********************************************
chinaunix网友2010-12-29 20:36:08
很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com
chinaunix网友2010-12-29 20:35:54
很好的, 收藏了 推荐一个博客,提供很多免费软件编程电子书下载: http://free-ebooks.appspot.com