当前位置: 移动技术网 > IT编程>开发语言>C/C++ > C语言程序

C语言程序

2019年03月10日  | 移动技术网IT编程  | 我要评论

女子放生900蛇,猥琐委员长小游戏,被上天诅咒的天才

 

程序01                                                                                                                                             

实现功能:比较两个数组相同元素的个数

 

 1 #include<stdio.h>
 2 //#define min(a,b) (a>b)?b:a
 3 char i;
 4 int find(int s[], int m, int n)
 5 {
 6         int j,c=0,t[100];
 7 //      j = min(m, n);
 8         printf("输入数组t:");
 9         for (i = 0; i < n; i++)
10         {
11                 scanf("%d",&t[i]);
12                 for (j = 0; j < m; j++)
13                 {
14                         if (t[i] == s[j])
15                         {
16                                 c++;
17                         }
18                 }
19         }
20         return c;
21 
22 }
23 int main(void)
24 {
25         int s[100];
26         int c;
27         int  m,n;
28         printf("输入m:");
29         scanf("%d", &m);
30         printf("输入s:");
31         for (i = 0; i < m; i++)
32         {
33                 scanf("%d", &s[i]);
34         }
35         printf("输入n:");
36         scanf("%d",&n);
37         c=find(s, m, n);
38         printf("输出c=%d\n", c);
39         return 0;
40 }
view code

 

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网