当前位置: 首页 > news >正文

医院做网站备案需要哪些资料如何逐步提升网站权重

医院做网站备案需要哪些资料,如何逐步提升网站权重,wordpress 换logo,网站建设类型的好处关于结构体的基础知识#xff0c;网上书上都一大堆#xff0c;这里就不赘述了#xff0c;下面我们要学习的是结构体指针。 介绍结构体指针之前#xff0c;先给大家看一个小程序#xff1a; [cpp] view plaincopy #include stdio.h #include string.h … 关于结构体的基础知识网上书上都一大堆这里就不赘述了下面我们要学习的是结构体指针。 介绍结构体指针之前先给大家看一个小程序 [cpp] view plaincopy #include stdio.h   #include string.h   #include malloc.h      struct Man   {       char name[10];   };      int main()   {       struct Man N;       N.name  qiang;       printf(%s\n,N.name);   }   这段程序很简单就是给结构体成员赋值这里结构体成员是个数组大家看看这种赋值方式有没有错我们编译一下 [cpp] view plaincopy fsubuntu:~/qiang/struct$ gcc -o struct4 struct4.c   struct4.c: In function ‘main’:   struct4.c:13:9: error: incompatible types when assigning to type ‘char[10]’ from type ‘char *’   fsubuntu:~/qiang/struct$    13行报错就是赋值那行报错原因是“字符分配的类型是不兼容的类型” 我们看看这句N.name qiang,右边是字符串常量这里其实是字符串的首地址就是一个地址我们以前 char a[] qiang没错啊为什么这里报错了我们看看左值N.name name 是数组名是代表数组的首地址啊但是我们要记住这里name是个地址常量是不能给常量赋值的所以会报错那我们如何给一个结构体中的字符数组赋值呢我们这里用strcpy(N.name,qiang) ! 当然我们N.name[1] q这样是可以的。 下面开始讲结构体指针 一、指向结构体类型变量的使用 首先让我们定义结构体 [cpp] view plaincopy span stylecolor:#000000;struct stu   {       char name[20];       long number;       float score[4];   };   /span   再定义指向结构体类型变量的指针变量 struct stu *p1, *p2 ; 定义指针变量p1、p2分别指向结构体类型变量。引用形式为指针变量→成员这里我们要注意非结构体指针引用类型是  结构体类型变量 . 成员 下面我们看一个例子 对指向结构体类型变量的正确使用。 输入一个结构体类型变量的成员并输出 [cpp] view plaincopy #include stdlib.h    #include stdio.h      struct data    {       int day,month,year;   };      struct stu    {       char name[20];       long num;       struct data birthday; /*嵌套的结构体类型成员*/   };      int main()    {       struct stu *student; /*定义结构体类型指针*/       student  malloc(sizeof(struct stu)); /*为指针变量分配安全的地址*/       printf(Input name,number,year,month,day:\n);       scanf(%s,student-name); /*输入学生姓名、学号、出生年月日*/       scanf(%ld,student-num);       scanf(%d%d%d,student-birthday.year,student-birthday.month,               student-birthday.day);              printf(\nOutputname,number,year,month,day\n);   /*打印输出各成员项的值*/       printf(%8s    %5ld  %d//%d//%d\n,student-name,student-num,           student-birthday.year,student-birthday.month,           student-birthday.day);   }   执行结果如下 [cpp] view plaincopy fsubuntu:~/qiang/struct/tmp$ ./struct1   Input name,number,year,month,day:   xiao   10086   2012   12   22      Outputname,number,year,month,day       xiao    10086  2012//12//22   fsubuntu:~/qiang/struct/tmp$    程序中使用结构体类型指针引用结构体变量的成员需要通过C提供的函数malloc()来为指针分配安全的地址。函数sizeof()返回值是计算给定数据类型所占内存的字节数。指针所指各成员形式为 [cpp] view plaincopy student-name   student-num   student-birthday.year   student-birthday.month   student-birthday.day   二、指向结构体类型数组的指针的使用         定义一个结构体类型数组其数组名是数组的首地址这一点前面的课程介绍得很清楚。         定义结构体类型的指针既可以指向数组的元素也可以指向数组在使用时要加以区分。 上个例子中定义了结构体类型根据此类型再定义结构体数组及指向结构体类型的指针 [cpp] view plaincopy struct data   {   intday,month,year;   };   struct stu/*定义结构体*/   {   char name[20];   long num;   struct data birthday;/*嵌套的结构体类型成员*/   };   [cpp] view plaincopy struct stustudent[4],*p;   /*定义结构体数组及指向结构体类型的指针*/   使pstudent此时指针p就指向了结构体数组student。 p是指向一维结构体数组的指针对数组元素的引用可采用三种方法。 1)地址法   studenti和pi均表示数组第i个元素的地址数组元素各成员的引用形式为 studenti-name、(studenti)-num和(pi)-name、pi-num等。studenti和pi与student[i]意义相同。 2)指针法 若p指向数组的某一个元素则p就指向其后续元素。 3)指针的数组表示法 若pstudent我们说指针p指向数组studentp[i]表示数组的第i个元素其效果与student[i]等同。对数组成员的引用描述为:p[i].name、p[i].num等 指向结构体数组的指针变量的使用 [cpp] view plaincopy #include stdio.h   #include malloc.h      struct data/*定义结构体类型*/   {       int year,month,day;   };      struct stu/*定义结构体类型*/   {       char name[20];       long num;       struct data birthday;   };      int main()   {       int i;       struct stu *p,student[4]{{liying,1,1978,5,23},{wangping,2,1979,3,14},           {libo,3,1980,5,6},{xuyan,4,1980,4,21}};       /*定义结构体数组并初始化*/       p  student;/*将数组的首地址赋值给指针p,p指向了一维数组student*/       printf(Outputname,number,year,month,day\n);       for(i  0;i  4;i)/*采用指针法输出数组元素的各成员*/           printf(%8s %6ld   %d//%d//%d\n,(pi)-name,(pi)-num,                   (pi)-birthday.year,(pi)-birthday.month,                   (pi)-birthday.day);          return 0;   }   执行结果如下 [cpp] view plaincopy fsubuntu:~/qiang/struct/tmp$ ./struct2   Outputname,number,year,month,day     liying      1   1978//5//23   wangping      2   1979//3//14       libo      3   1980//5//6      xuyan      4   1980//4//21   fsubuntu:~/qiang/struct/tmp$    附给大家看一个有意思的程序 写出一个模拟时钟程序 分析我们知道时间有时 分 秒 组成这里用结构体表示 代码如下 [cpp] view plaincopy #include stdio.h   #include unistd.h   #include malloc.h   #include string.h      typedef struct Clock   {       int hour;       int minute;       int second;   }Clock;      update(Clock *p)   {       p-second;          if(p-second  60)       {           p-second  0;           p-minute;       }          if(p-minute  60)       {           p-minute  0;           p-hour;       }       if(p-hour  24)           p-hour  0;   }      Display(Clock *p)   {       printf(\r%02d:%02d:%02d,p-hour,p-minute,p-second);//%02d中0 输出数值时指定左面不使用的空位置自动填0达到00:00:00效果       fflush(stdout);//前面曾经讲过printf属于行缓冲遇到\n或程序结束才会输出这里没有\n所以用fflush刷新   }      int main()   {       Clock *clock;       clock  (Clock *)malloc(sizeof(Clock));       memset(clock,\0,sizeof(Clock));//时钟初始化          while(1)       {           sleep(1);           update(clock);           Display(clock);       }       free(clock);       return 0;   }   执行结果如下 [cpp] view plaincopy fsubuntu:~/qiang/struct$ ./clock   00:00:01   [cpp] view plaincopy fsubuntu:~/qiang/struct$ ./clock   00:00:55   这里是个动态效果大家可以打印出来看一下
http://www.sadfv.cn/news/193960/

相关文章:

  • 音乐网站建设程序建站哪家好联系兴田德润
  • 资源下载站 wordpress动漫设计与游戏制作学什么
  • 高端网站设计欣赏个体工商户经营范围做网站
  • 做网站推荐源创网络个人做网站需要备案吗
  • 网站怎么做才有效果网站开发用什么浏览器
  • 哪里去找做的好看的网站深圳菜谱制作
  • 视频网站是怎么做权限管理的WordPress中文音乐主题
  • 农业推广网站建设应用商店下载app
  • 兰州工程建设信息网站景德镇建设企业网站
  • 深圳福田区住房和建设局网站产品开发岗位职责
  • 珠海网站建设的公司排名中国建设注册管理中心网站
  • 义乌做网站公司哈密seo
  • wordpress建站模板电商网站用php做的吗
  • 启东市住房城乡建设局网站福州建设公司名单
  • 公司建站文案给网站公司看的卸载ghost版wordpress
  • 新开传奇网站180火龙网站建设合同印花税
  • 深圳营销型网站策划北京网站建设华网
  • 传奇网站架设方法免费建站网站网页
  • 建网站有哪些费用汕头企业网络推广
  • 苏州企业网站建设公司只选亿企邦wordpress 本地链接
  • 有限公司网站建设 互成网络地址 四川企业查询网
  • 做网站维护要什么专业Apple 手机网站制作
  • 寿光做网站的公司广告公司网站制作
  • 手机在线做ppt的网站python app开发
  • 公司备案证查询网站查询系统解除网站开发合同 首付款是否退
  • 金融培训网站源码网站做404好处
  • 滁州建设网站公司大朗做网站公司
  • 网站怎么做h5支付宝支付接口在线ui设计
  • 网站怎么设置标题广州网站建设费用多少
  • 马大姐网站建设目的网页设计免费网站推荐