博客
关于我
东北林业大学锐格系统大一(指针与函数)
阅读量:397 次
发布时间:2019-03-04

本文共 3627 字,大约阅读时间需要 12 分钟。

感觉自己最近都要写博客,看C语言了,因为快考试了,最近压力好大啊!!!!

话不多说,指针与函数,开始吧!!!

[5880](https://222-27-166-246.webvpn.nefu.edu.cn/studentExercise/index?currentClassId=459#4880_exercise_716_在这里插入图片描述

#include 
#include
int main(){ float **a,*b,s; int n,i,j; while(scanf("%d",&n)!=-1) { a=(float *)malloc(sizeof(float *)*n); for(i=0;i

在这里插入图片描述

#include 
#include
int main(){ char a[100]; char *p; int i,j,n,f,l; int strat,end; int b[100]={ 0}; while(~scanf("%d",&n)) { for(f=0;f
='A')||(*(p+i)<='z'&&*(p+i)>='a')) { strat=i;break;} } for(i=l-1;i>=0;i--) { if((*(p+i)<='Z'&&*(p+i)>='A')||(*(p+i)<='z'&&*(p+i)>='a')) { end=i;break;} } j=1; int num=0; for(i=strat;i<=end;i++) { if((p[i]>='a'&&p[i]<='z')||(p[i]>='A'&&p[i]<='Z')) { printf("%c",p[i]); if(i==end) { num++;printf("\n");break; } if(!(p[i+1]>='a'&&p[i+1]<='z')||(p[i+1]>='A'&&p[i+1]<='Z')) { printf(" ");num++;} } } printf("分出了%d个单词\n",num); } } return 0;}

这个题算法很重要!!!!!!!

#include 
#include
void count(char *p){ int i,start,end,num=0; for(i=0;i
='a'&&p[i]<='z')||(p[i]>='A'&&p[i]<='Z')) { start=i;break;} for(i=strlen(p)-1;i>=0;i--) if((p[i]>='a'&&p[i]<='z')||(p[i]>='A'&&p[i]<='Z')) { end=i;break;} for(i=start;i<=end;i++){ if((p[i]>='a'&&p[i]<='z')||(p[i]>='A'&&p[i]<='Z')){ printf("%c",p[i]); if(i==end) { num++;printf("\n");break; } if(!(p[i+1]>='a'&&p[i+1]<='z')||(p[i+1]>='A'&&p[i+1]<='Z')) { printf(" ");num++;} } } printf("分出了%d个单词\n",num);}int main(){ int n; while(~scanf("%d",&n)){ while(n--){ char a[1010]; char *p=a; scanf(" "); gets(p); count(p); } } return 0;}

这个用了指针函数,学学习

在这里插入图片描述

#include 
#include
char *fun(char*p[],int num){ int i,max=0,mi; for(i=0;i
max){ max=num;mi=i; } } return p[mi];}int main(){ int n; while(~scanf("%d",&n)){ char a[100][55]; char *p[100]; int i; for(i=0;i

真是从未看懂过的代码

在这里插入图片描述

#include 
#include
#include
void sort1(char **pp,int n){ int i,j;char temp[51]; for(i=0;i
0) { strcpy(temp,pp[i]); strcpy(pp[i],pp[j]); strcpy(pp[j],temp); } } }//补充完成程序}void output1(char *p[],int n){ int i; for(i=0;i

这里特别注意,字符串指针需要进行复制输入

l=strlen(str);           cp[i]=(char*)malloc(sizeof(char)*l);             strcpy(cp[i],str);

在这里插入图片描述

#include 
#include
#include
int order;double initial,x;//x表示精度double f(int order,double x){ if(order==1) return x*x*x-x*x-1; if(order==2) return x*x*x*x-3*x+1; if(order==3) return x-exp(-x);}double f2(int order,double x){ if(order==1) return 3*x*x-2*x; if(order==2) return 4*x*x*x-3; if(order==3) return 1+exp(-x);}int main(){ while(~scanf("%d%lf%lf",&order,&initial,&x)){ double now=initial-f(order,initial)/f2(order,initial); double pre=initial;//换个名字,initial太难打了 while(fabs(now-pre)>x){ pre=now; now=pre-f(order,pre)/f2(order,pre); } printf("%d %.2e %.5lf\n",order,x,now); }}

转载地址:http://aifg.baihongyu.com/

你可能感兴趣的文章
mysql replace first,MySQL中处理各种重复的一些方法
查看>>
MySQL replace函数替换字符串语句的用法(mysql字符串替换)
查看>>
Mysql Row_Format 参数讲解
查看>>
mysql select, from ,join ,on ,where groupby,having ,order by limit的执行顺序和书写顺序
查看>>
MySQL Server 5.5安装记录
查看>>
mysql slave 停了_slave 停止。求解决方法
查看>>
MySQL SQL 优化指南:主键、ORDER BY、GROUP BY 和 UPDATE 优化详解
查看>>
mysql sum 没返回,如果没有找到任何值,我如何在MySQL中获得SUM函数以返回'0'?
查看>>
mysql Timestamp时间隔了8小时
查看>>
Mysql tinyint(1)与tinyint(4)的区别
查看>>
mysql union orderby 无效
查看>>
mysql where中如何判断不为空
查看>>
mysql workbench6.3.5_MySQL Workbench
查看>>
MySQL Workbench安装教程以及菜单汉化
查看>>
MySQL Xtrabackup 安装、备份、恢复
查看>>
mysql [Err] 1436 - Thread stack overrun: 129464 bytes used of a 286720 byte stack, and 160000 bytes
查看>>
MySQL _ MySQL常用操作
查看>>
MySQL – 导出数据成csv
查看>>
MySQL —— 在CentOS9下安装MySQL
查看>>
mysql 不区分大小写
查看>>