任务1源码
任务1结果
生成随机弹幕:
任务2源码
任务2结果
任务3源码
任务3结果
任务4源码
迭代
递归
任务4结果
迭代
递归
任务5源码
任务5结果
任务6源码
任务6结果
任务7源码
1 #define _CRT_SECURE_NO_WARNINGS 2 #include<stdio.h> 3 #include<math.h> 4 int store_num(int a[],int num) 5 { 6 int count = 0; 7 do 8 { 9 a[count] = num % 10; 10 num /= 10; 11 count++; 12 }while (num > 0); 13 return count; 14 } 15 int is_single(int j,int n2[],int len2,int n3[],int len3) 16 { 17 int count; 18 count = 0; 19 int t = 0; 20 for (t = 0; t < len2; t++) 21 { 22 if (n2[t] == j) 23 { 24 count++; 25 } 26 } 27 for (t = 0; t < len3; t++) 28 { 29 if (n3[t] == j) 30 { 31 count++; 32 } 33 } 34 if (count != 1) 35 { 36 return 1; 37 } 38 else 39 { 40 return 0; 41 } 42 } 43 int main() 44 { 45 int i = 40; 46 while (1) 47 { 48 int num2 = 0, num3 = 0, len2 = 0, len3 = 0, len = 0; 49 int n2[10] = { 0 }; 50 int n3[10] = { 0 }; 51 num2 = pow(i, 2); 52 num3 = pow(i, 3); 53 len2 = store_num(n2,num2); 54 len3 = store_num(n3,num3); 55 len = len2 + len3; 56 int j = 0; 57 int t = 0; 58 int count; 59 if (len == 10) 60 { 61 int re = 0; 62 for (j = 0; j < 10; j++) 63 { 64 re+=is_single(j, n2, len2, n3, len3); 65 } 66 if (re == 0) 67 { 68 printf("%d", i); 69 break; 70 } 71 } 72 i++; 73 } 74 return 0; 75 }
任务7结果
标签:count,10,num,int,++,源码,实验 From: https://www.cnblogs.com/syf0824/p/17800069.html