您好,欢迎访问一九零五行业门户网

html+c++ 以html形式记录笔记_html/css_WEB-ITnose

wzzx sts
.d{position:fixed;top:0px;left:0px;width:100%;height:100px;background-color:ff90dd}
_ 首页 _
_ 1 __ 2 __ 3 __ 4 __ 5 _  
_ 6 __ 7 __ 8 __ 9 __ 10_
_ 11__ 12 __ 13 __ 14 __ 15
_  
_ 16 __ 17 __ 18 __ 19 __
20_
1  
【命名空间】
            namespace std;
            namespace wz
              { int a=10;
               void fun() {}  可以命名函数
               }
       变量引用:单一引用为wz::a;全引用为using  namespace wz ;
【函数重载】
            用同样的函数名做不一样的事;机制为重命名;
           int add(int a,int b){} float add(float a,float b){} 
【缺省参数】
           int add(int a=1,int b=0){return a+b;}main中add(1)为1。add(1,1)为2;
           全缺省/半缺省
【引用和指针】
         int& refa=10;必须初始化,自加为量变大   sizeof(refa)=8/4/2看引用类型               特别的引用量间的地址是一样的
         *p:                  p++ 自加为地址偏移  sizeof(p)=4      始终为4
【内存对齐】
           char 2/int4 =8 char 2/double 8/int4 =24 class类和struc结构体一致
【析构函数】
            没有参数,不能重载;虽然为默认函数,但没有内存回收,需要自己写关闭文件等代码。

2 externc //c++ 引入c代码
double i=1.234
const int& refi=i;
cout
这个是不一样的地址;const必须加;

1

2
1
while(check)
{
cc=player(c,aa);
bb=play(b,cc);
aa=play(c,bb);
check=a||b||c;
}
int player(int c[],int aa[])
{
int m[25]={0};
int i,j,k;
int count=0;
int xx=0;
for(i=0;i
{ if(aa[i]!=0)
     { count++; if(count==1) x=1;
                if(count==2) x=2;                 
     }
 }
switch(x)
 {
  case 1:{
          printf(please enter a number;\n );
          scanf(%d,xx);
          aa[0]=xx;
          }
//  case 2:fun2(v,m);
  }
for(i=0;i
{
printf(%3d,m[i]);
}
printf(\n);
return m;
}
int play(int v[],int vv[])
{
int m[25]={0};
int i,j,k;
int count=0;
for(i=0;i
{ if(vv[i]!=0)
     { count++; if(count==1) x=1;
                if(count==2) x=2;                 
     }
 }
switch(x)
 {
  case 1:fun1(v,m);
//  case 2:fun2(v,m);
  }
for(i=0;i
{
printf(%3d,m[i]);
}
printf(\n);
return m;
}
void fun1(int v[],int m[])
{
int t=0;
t=v[1];
m[0]=t;
v[1]=0;
}
void fun2(int v[],int m[])
{
}
{
int a[10]={1,3,5,7,9,2,4,6,8,0};
3 1                 0
3 5 1               1
3 5 7 1             2
3 5 7 9 1           3
3 5 7 9 2 1         4
3 5 7 9 2 4 1       5
3 5 7 9 2 4 6 1     6
3 5 7 9 2 4 6 8 1   7
3 5 7 9 2 4 6 8 1 0 8
//
5 3                 0
5 7 3               1
5 7 9 3             2
5 7 9 3 2           3
5 7 9 3 4 2         4
5 7 9 3 4 6 2       5
5 7 9 3 4 6 8 2     6
5 7 9 3 4 6 8 2 1 0 7
//
0 7 5
1 7 9 5
2 7 9 5 3
3 7 9 5 4 3
4 7 9 5 4 6 3
5 7 9 5 4 6 8 3
6 7 9 5 4 6 8 3 2 1 0
//
0 9 7
1 9 7 5 4 6 8 3 2 1 0
2 9 7 5 4 6
3 9 7 5 6 4
4 9 7 5 6 8 4 3 2 1 0
5 9 7 5 6 8 4 3 2 1 0
//
0 9 7
1 9 7 5
2 9 7 6 5
3 9 7 6 8 5 4
4 9 7 6 8 5 4 3 2 1 0
//
0 9 7
1 9 7 6
2 9 7 8 6 5
3
//
0 9 7
1 9 8 7 6 5
//
0 9 8
#include
#include
#define n 4
#define m 4
#define datatype int
typedef struct linklist
{       
        datatype  data;
     struct linklist   *left;   
     struct linklist   *right;
}linknode,*l,*r;
void fun1()
{
 int i=0,j=0,k=0,a[n][m]={0};
 for(i=0;i for(j=0;j {
scanf(%d,&a[i][j]);
printf(%2d,a[i][j]);
 }
}
void fun2()
{
int i=0,j=0,k=0,a[n][m]={0};
for(i=0;i for(j=0;j {
scanf(%d,&a[i][j]);
 }
 fflush(stdin);
for(i=0;i for(j=0;j {
printf(%2d,a[i][j]);
 }
fflush(stdout);
}
void fun3()
{
int a[10]={11,2,5,6,7,3,4,9,10,1};
int l;
int i,j,t;
int b[3]={10,10,10};
for(l=0;l
 {
  if(a[l]
  b[0]=a[l];
for(i=0;i
 { 
  for(j=i;j
   {  
     if (b[j]
    }
 }
}
for(i=0;i
}
 void fun4()
{
int l=1;
l mylist=(linknode* )malloc(sizeof(linknode));
//list headcopy=(linknode* )malloc(sizeof(linknode));
mylist->data=1;
}
void main()
{
//printf(\n  test 1 enter %d*%d number\n,n,m);
//fun1();
//printf(\n  test 2 enter %d*%d number\n,n,m);
//fun2();
printf(\n  test  \n \n,n,m);
//fun3();
fun4();
printf(\n  test  had finish\n,n,m);
}
#include
#include
#define datatype int
typedef struct linklist
{
        datatype  data;
struct linklist   *next;
}linknode,* list;
void fun2(list head)
{
  list p=head;
  while(p->next!=null)
  {
    p=p->next;
    printf(%d,p->data);
   }
//free(head);
}
int judge(list mylist1)
{
  int l=6,j=8;list p=mylist1; list s=mylist1,t=mylist1;
  printf(\n%d\n,l);
while(j){printf(%2d,p->data);p=p->next;j--;}
while(l){s=s->next;t=(t->next)->next;
          if(t->next=s){printf(\n it is loop\n);break;}   
          l=l-1;
        }
return 0;
}
void ysf(list head)
{ int count=0;//  4;
  int r=4;
  list p=head->next;  
   list del=null;
while(r>1)
{ while(count
  {
   p=p->next;
   count++;
  }
 del=pd->next;r--;
 p->next=del->next;
 free(del);
}
}
void main()
{int l=1;
list mylist=(linknode* )malloc(sizeof(linknode));
list headcopy=(linknode* )malloc(sizeof(linknode));
list mylist1=(linknode* )malloc(sizeof(linknode));
list p=mylist1;
while(l
{
list  newnode=(linknode* )malloc(sizeof(linknode));
newnode->data=l;
p->next=newnode;
p=p->next;
l++;
}
p->next=mylist1->next;
 judge(mylist1);
//wutoushan();
ysf(mylist);
judge(mylist1);
}
#include
#include
#include
void display(int x,int y,int m,int max)
{
int s[6][7]={0};int i=0,j=0;
  s[0][m]=1;//确定每一月的根基 每个月的第一列 
for(j=m;j
s[1][0]=s[0][6]+1;
for(i=2;i
  for(i=1;i
  { for(j=1;j
     s[i][j]=s[i][0]+j;
  }
printf(\t%d年  %d月\n,x,y);
printf(----------------------\n);
printf( 日 一 二 三 四 五 六 \n);
for(i=0;i
  { for(j=0;j
    {
   if(s[i][j]==0)printf(   );
   if(s[i][j]!=0&&s[i][j]
   printf(\n);  
  }
}
int year(int year)
{
if(year%4==0&&year%100!=0||year%400==0)return 1;
else return 0;
}
void  fun()
{
int i,j;
int max[13]={0,30,31,32,33,30,30,30,30,30,30,30,30};
int star[13]={1,2,3,4,5,5,1,6,5,4,3,2,1,};
int x[42]={0};
for(i=1;i
  {printf(%d year %d math\n,2015,i);
   printf( 7  1  2  3  4  5  6 \n);
   printf(---------------------\n );
    for(j=star[i];j
   {    x[j]=x[j-1]+1;}
    for(j=0;j
   { 
     if(j>0&&j%7==0)printf(\n);
     if(x[j]==0)printf(   );   
     if(x[j]!=0&&x[j]   }
  printf(-----happy new year---\n);
  }
}
void main()
{
int max[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int year=2016;
int month=2;//1-12
int star[13]={0,1,32,60,91,121,152,182,213,244,274,304,334};//0-6
int i=1;
int count=0;
if(year(year)) {max[2]++;for(i=3;i
for(i=1;i{if(year(i))count++;}
for(i=1;i
 {//star[i]= (1+2*i+3*(i+1)/5+year+year/4-year/100+year/400)%7;
  star[i]=(star[i]+(year-1)*365+count)%7;
 display(year,i,star[i],max[i]); 
 }
//fun();
}

2
其它类似信息

推荐信息