二级题库24.

1.#include  <stdio.h>
double f1(double  x)
{  return x*x;  }
double f2(double  x, double  y)
{  return  x*y;  }
/**********found**********/
__1__ fun(int  i, double  x, double  y)
{ if (i==1)
/**********found**********/
    return __2__(x);
  else
/**********found**********/
    return  __3__(x, y);
}
void main()
{ double  x1=5, x2=3, r;
  r = fun(1, x1, x2);
  r += fun(2, x1, x2);
  printf("\nx1=%f, x2=%f, x1*x1+x1*x2=%f\n\n",x1, x2, r);
}

2.#include <conio.h>
#include <stdio.h>
/*************found**************/
double fun(char *s,char *t)
{
  int s1=0,t1=0;
  char *ss,*tt;
  ss=s;
  tt=t;
  while(*ss)
  {
    s1++;
  /*************found**************/
    (*ss)++;
  }
    while(*tt)
  {
    t1++;
/*************found**************/
    (*tt)++;
  }
  if(t1>s1)
    return t;
  else
    return s;
}
void main()
{
  char a[80],b[80];
  printf("\nEnter a string : ");
  gets(a);
  printf("\nEnter a string again: ");
  gets(b); 
  printf("\nThe longer is :\n\n%s\n", fun(a,b));
}

3.#include <stdio.h>
#include <string.h>
#define   N    80
void fun (char  *w,int  m)
{
  
}
void main()
{
  FILE *wf;
  char  a[N]= "ABCDEFGHIJK",b[N]= "ABCDEFGHIJK";
  int  m;
  printf("The origina string :\n");
  puts(a);
  printf("\n\nEnter  m: ");
  scanf("%d",&m);
  fun(a,m);
  printf("\nThe string after moving :\n");
  puts(a);
  printf("\n\n");
/******************************/
  wf=fopen("out.dat","w");
  fun(b,3);
  fprintf(wf,"%s",b);
  fclose(wf);
/*****************************/
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值