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

做网站有必要做app吗哈尔滨红军街67号

做网站有必要做app吗,哈尔滨红军街67号,东营注册公司,什么网站的页面好看一、自己实现和库函数提供的strcpy以及strcat功能完全相同的函数(返回值是指针&#xff0c;并且可以直接使用puts(strcpy)输出拷贝结果) char *my_strcpy(char *dest,char *src) #include <stdio.h> #include <string.h> #include <stdlib.h> int my_strca…

一、自己实现和库函数提供的strcpy以及strcat功能完全相同的函数(返回值是指针,并且可以直接使用puts(strcpy)输出拷贝结果)

  1. char *my_strcpy(char *dest,char *src)
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int my_strcat(char *p1,char *p2)
{    int i=0,j=0;while(*(p1+i)){i++;}while(*(p2+j)){                                  *(p1+i)=*(p2+j);i++;j++;}*(p1+i)=*(p2+j);
}
int main(int argc, const char *argv[])
{char str1[52]="hello";char str2[20]="world";char *p1=str1;char *p2=str2;my_strcat(str1,str2);printf("%s\n",str1);printf("%p\n",strcat(str1,str2));printf("%p\n",str1);return 0;
}

           2.char *my_strcat(char *dest,char *src)

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int my_strcpy(char *p1,char *p2)
{while((*p1)){*(p2)=*(p1);p1++;p2++;}*(p2)=*(p1);
}
int main(int argc, const char *argv[])
{char str1[7]="hh";char str2[8]="hhh";char *p1=str1;char *p2=str2;my_strcpy(str1,str2);printf("%s\n",str2);printf("%p\n",strcat(str1,str2));printf("%p\n",str2);return 0;
}                                        

二、实现一个可以返回数组中最大元素地址的函数

int *find_max(int *arr,int len)

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int *find_max(int *arr, int len)
{int *max_p = arr;for (int i = 0; i < len; i++){ if (*max_p < *(arr + i)){max_p = arr + i;}}return max_p;
}int main(int argc, const char *argv[])
{int arr[] = {7, 8, 1, 1, 87, 78, 11};int len = sizeof(arr) / sizeof(arr[0]);int *max = find_max(arr, len);printf("数组中的最大元素是:%d\n",*max);return 0;
}                                                

三、实现一个函数实现删除字符串中空格的操作

char *del(char *s)

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
char  *del(char *s)
{char *yuan = s;char *new = s;while(*yuan!='\0'){if(*yuan != ' '){*new = *yuan;new++;}yuan++;}*new ='\0';return s;
}
int main(int argc, const char *argv[])
{char str[100];char jg[100];char *yuan =str;char *new = jg;printf("请输入一个字符串:");gets(str);char *zh  =del(str);printf("删除空格后的字符串:%s\n",zh);return 0;                               
}

  1. 有以下定义,说明哪些量可以改变哪些不可以改变?

const char *p;

const (char *) p;

char *const p;

const char* const p;

char const *p;

(char *) const p;

char const* const p;

定义指针指向能否改变指针指向的内容能否改变
const char *p;char const *p;不能
const (char *) p;(char *) const p;char * const p;不能
const char* const p;char const* const p;不能不能

    四、将前面循环时写的打怪兽的小游戏,每一个功能封装成函数

#include <stdio.h>
#include <stdlib.h>
int a = 10000;  // 怪兽血量
int b = 0;       // 攻击次数
int j[] = {50, 70, 90};  // 技能攻击值
int z[] = {5, 3};        // 装备攻击值
int g = 0;       // 当前攻击力
void cd();
void jxz(int choice);
void zxz();
void gs();
void jg();
void cd()
{printf("请选择技能:\n");printf("'1':技能一(%d攻击值),'2':技能二(%d攻击值),'3':技能三(%d攻击值),'4':拾取装备,'5':退出游戏\n",j[0], j[1], j[2]);
}
void jxz(int choice)
{switch (choice){case 1: g = j[0]; break;case 2: g = j[1]; break;case 3: g = j[2]; break;}
}
void zxz()
{int z_choice;printf("请选择装备:\n");printf("'1':刀+5攻击值,'2':木棍+3攻击值\n");scanf("%d", &z_choice);if (z_choice == 1){g += z[0];}else if (z_choice == 2){g += z[1];} else{printf("无效的选择,已忽略。\n");}
}
void gs()
{a -= g;b++;printf("怪兽剩余血量:%d\n", a);g = 0;
}
void jg()
{printf("怪兽被杀死!一共攻击了%d次。\n", b);
}
int main()
{int choice;while (a > 0){cd();scanf("%d", &choice);switch (choice){case 1:case 2:case 3:jxz(choice);break;case 4:                                                                                          zxz();break;case 5:printf("退出游戏。\n");return 0;default:printf("无效选择,请重新选择。\n");continue;}gs();}jg();return 0;
}

    六、’写一个函数实现对二维数组中元素的输出

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void pt(int arr[][3],int hang,int lie )
{for(int i=0;i<hang;i++){for(int j=0;j<lie;j++){printf("%4d",arr[i][j]);}printf("\n");}
}
int main(int argc, const char *argv[])
{int arr[2][3]={{1,7,8},{9,8,87}};pt(arr,2,3);return 0;
}                                       


文章转载自:

http://qnPSkP9E.pdxqk.cn
http://yDHawfbF.pdxqk.cn
http://hUECp532.pdxqk.cn
http://4cf1QniL.pdxqk.cn
http://axE1ZU33.pdxqk.cn
http://V7C5xXO4.pdxqk.cn
http://q1ldPmwk.pdxqk.cn
http://UXZIBwJD.pdxqk.cn
http://cArzyVCs.pdxqk.cn
http://ZCK2sop4.pdxqk.cn
http://8ph7bo98.pdxqk.cn
http://NcGcMvTy.pdxqk.cn
http://VLMBp9Ku.pdxqk.cn
http://Ki1EKn8N.pdxqk.cn
http://gCOOvWqO.pdxqk.cn
http://TXF2GGur.pdxqk.cn
http://oLfp1P8y.pdxqk.cn
http://lYVJnpQZ.pdxqk.cn
http://IEWAwcWD.pdxqk.cn
http://7lU8KDr8.pdxqk.cn
http://wBqKkARJ.pdxqk.cn
http://Cv0FZ2kE.pdxqk.cn
http://K1qSOTp6.pdxqk.cn
http://9ATdVBs3.pdxqk.cn
http://dhKyGxIt.pdxqk.cn
http://F5rErV2I.pdxqk.cn
http://G6YvLeCL.pdxqk.cn
http://0vGA39TI.pdxqk.cn
http://3CI9TA0l.pdxqk.cn
http://yJvuW9zG.pdxqk.cn
http://www.dtcms.com/wzjs/631920.html

相关文章:

  • 墙绘网站建设推广做网站一般用什么几号字
  • 网站购物车设计网络布线设计方案
  • 成都企业网站建设 四川冠辰科技企业网站推广 知乎
  • 哈尔滨公司网页制作seo外链建设的方法
  • 网站的建设运营收费是哪些ppt制作手机版
  • 湛江建站程序35互联网站建设怎么样
  • 怎样做免费外贸网站wordpress的asp版
  • 江苏省建设工程管理局网站wordpress主题 大
  • 做网站域名的设置网站制作大概需要多少钱
  • 学校网站建设流程wordpress创建空白网页
  • 建设部网站继续教育专业百度seo排名优化
  • 新浪网站首页wordpress前端投稿插件
  • 佛山自定义网站建设各大网站投稿邮箱
  • 南阳市宛城区建设局网站seo推广的特点
  • 东莞网站设计品牌公司如何建设一个网站
  • 做网站运营好还是SEO好做酒类直供网站行吗
  • php 公司网站做网站被坑
  • 中国建设工程协会网站微信怎么弄自己的公众号
  • 贵州建设厅考试网站安全员网站建设怎么设计更加吸引人
  • 苏州网站建站aso排名优化
  • 成都网站建设贴吧哪个网站平面设计做的好
  • 中国建设企业银行app下载宁波seo营销
  • 餐饮美食网站源码wordpress表格布局插件
  • 中学网站模板微博嵌入wordpress
  • 江西建设银行官方网站小程序商城哪家好排行榜
  • 建网站公司公司在哪里找给公司做网站优化的人
  • 软件开发网站建设维护运营网站要多少费用
  • 重庆微网站建设哪家好wordpress 去掉骄傲的
  • 邯郸网站建设怎么做免费外贸网站制作
  • 做网站编辑的时候没保存怎么欢迎访问陕西省交通建设集团公司网站