哪位好心的大伯大妈GGMM帮忙做考试题啊

来源:百度知道 编辑:UC知道 时间:2024/09/13 02:15:20
1.编制一个自定义函数,函数的形参为字符数组s1和s2,函数功能是将字符串s1中的所有数字字符取出,存入另一字符数组s2中,使s2成为一个新的字符串,并在函数中将字符串s2输出。
2.不使用库函数,实现strlen函数的编写:形参类型为字符数组或字符串,要求统计字符串str中字符的个数。返回字符个数。函数原型为:unsigned int strlen (char *str)。
3.实现任意输入数值,建立一个单向链表,并按反向进行输出。
4.已知某数列前两项分别为2和3,其后继项根据数列最后两项的乘积,按下列规则生成:
(1)若乘积为一位数,则该乘积即为数列的后继项;
(2)若乘积为二位数,则该乘积的十位数字和个位数字依次作为数列的两个后继项。
编制程序计算数列前20 项之和并输出数列中的各项(要求将数列前20项保存在数组中且不可多存)。
(例如,数列前10项为:2,3,6,1,8,8,6,4,2,4)
这个问题只能用C语言做,不能用C++或者其他语言做,最好又注释的,不胜感激

1)
  #include<stdio.h>
  #include<string.h>
  void main()
  {
  char s1[80],s2[80];
  int i=0,j=0;
  printf("\nInput string1.\n");
  scanf("%s",s1);
  printf("\nInput string2.\n");
  scanf("%s",s2);
  while(s2[i]!='\0')
  i++;
  while(s1[j]!='\0')
  s2[i++]=s1[j++];
  s2[i]='\0';
  printf("The new string is:%s\n",s2);
  }
  2)
  #include<stdio.h>
  void main()
  {
  int i=0;
  char str[50];
  printf("\nInput one string.\n");
  scanf("%s",str);
  while(str[i]!='\0')
  i++;
  printf("\nThe number is:%d\n",i);
  }
  3)
  #include"stdio.h"
  #include"stdlib.h"
  typedef struct node
  {
  int data;
  struct node