第一范文网 - 专业文章范例文档资料分享平台

计算机二级c语言编程100题

来源:用户分享 时间:2025/8/24 12:11:26 本文由loading 分享 下载这篇文档手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。

如有你有帮助,请购买下载,谢谢!

#include #include

void fun(char *a,char *h,char *p) {char b[81],*x; int i=0,j=0; x=a;

while (x

if (*h!='*') {b[j]=*h;j++;h++;} else h++; p++;

while (*p) {b[j]=*p;j++;p++;} b[j]='\\0';j=0; while (b[j])

{ a[i]=b[j];i++;j++;} a[i]='\\0'; }

main()

{ char s[81],*t,*f;

printf(\ t=f=s;

while(*t) t++; t--;

while (*t=='*') t--; while (*f=='*') f++; fun(s,f,t);

printf(\ NONO(); } 2

#include #include

double fun ( double eps) {

int n=0;

double down=1,up=1; double one ,pi=0;

one = (double)up/(double)down; while(one>=eps) { pi+=one; n++; up=up*n;

down=down*(2*n+1);

one=(double)up/(double)down;

1页

如有你有帮助,请购买下载,谢谢!

}

return pi*2; }

main( )

{ double x;

printf(\

scanf(\ NONO(); } 3

#include

char *fun ( char *s, char *t) {

int first=0,second=0; char *p,*q; p=s; q=t;

while(*p++!='\\0') first++;

while(*q++!='\\0') second++; if(first==second) return s;

else if (first>second) return s; else

return t; }

main( )

{ char a[20],b[10];

printf(\ gets( a);

printf(\ gets( b);

printf(\ NONO (); } 4

#include #include void fun(char *a,int n) { char b[81];

int i=0,j=0,s=0,k;

while (a[i]=='*') {s++;i++;}

2页

如有你有帮助,请购买下载,谢谢!

if (s>n)

{ for (k=0;k

{ a[i]=b[j];i++;j++;} a[i]='\\0'; } }

main()

{ char s[81];int n;

printf(\ printf(\ \ fun(s,n);

printf(\ NONO(); } 5

#include

float fun ( float *a , int n ) {

int i;

float average; double sum=0; for(i=0;i

average=(float)sum/n; return average; }

main()

{ float score[30]={90.5, 72, 80, 61.5, 55}, aver; aver = fun( score, 5 );

printf( \ is: %5.2f\\n\ NONO ( ); } 6

#include #define N 8 typedef struct

{ char num[10]; double s[N]; double ave;

3页

搜索更多关于: 计算机二级c语言编程100题 的文档
计算机二级c语言编程100题.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.diyifanwen.net/c9w9x77s8uc7b3ef97wu606i7k4ff8500zf7_1.html(转载请注明文章来源)
热门推荐
Copyright © 2012-2023 第一范文网 版权所有 免责声明 | 联系我们
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:xxxxxx 邮箱:xxxxxx@qq.com
渝ICP备2023013149号
Top