Auto commit

This commit is contained in:
smallkun 2025-03-31 18:13:34 +08:00
parent 7c1ff398ef
commit 4afd009240
8 changed files with 279 additions and 0 deletions

View File

@ -0,0 +1,36 @@
/*-----------------------------------------------------------------------
-------------------------------------------------------------------------
fun :m k(1<k<26)
8 2,1000
(8 1000)
------------------------------------------------------------------------
----------------------------------------------------------------------*/
#include <stdio.h>
// 函数声明
void fun(int m, int k);
int main()
{
int m, k;
printf("【请输入十进制正整数m 和进制k1 < k < 26");
scanf("%d %d", &m, &k);
if (k <= 1 || k >= 26)
{
printf("错误k 的值必须在 2 到 25 之间。\n");
return 1;
}
fun(m, k);
return 0;
}
void fun(int m, int k)
{
char result[65];
int remainder, i;
int index = 63;
result[64] = '\0';
/**********Program**********/
/********** End **********/
printf("\n");
}

View File

@ -0,0 +1,28 @@
/*-----------------------------------------------------------------------
-------------------------------------------------------------------------
n,n
(1 3 )3 退
n: 99
88
-------------------------------------------------------------------------
------------------------------------------------------------------------*/
#include <stdio.h>
int josephus(int n)
{
/**********Program**********/
/********** End **********/
}
int main()
{
int n;
int result;
printf("【请输入整数n: 】");
scanf("%d", &n);
result = josephus(n);
printf("最后留下的是原来第%d 号的那位\n", result);
return 0;
}

View File

@ -0,0 +1,43 @@
/*-----------------------------------------------------------------------
-----------------------------------------------------------------------
100 222 656 899 65
978
-------------------------------------------------------------------------
------------------------------------------------------------------------*/
#include <stdio.h>
int sum_of_even(int arr[], int size);
int main()
{
int numbers[5];
int i;
int even_sum;
printf("【请输入五个正整数:】");
for (i = 0; i < 5; i++)
{
if (scanf("%d", &numbers[i]) != 1)
{
printf("输入有误,请确保输入了五个整数。\n");
return 1;
}
if (numbers[i] <= 0)
{
printf("输入有误!请确保输入的是正数。\n");
return 1;
}
}
even_sum = sum_of_even(numbers, 5);
printf("【这五个正整数中的偶数之和为:】%d\n", even_sum);
return 0;
}
int sum_of_even(int arr[], int size)
{
int sum = 0;
int i;
/**********Program**********/
/********** End **********/
}

View File

@ -0,0 +1,31 @@
/*-----------------------------------------------------------------------
-----------------------------------------------------------------------
*fun:
*
*
:"*******A*BC*DEF*G****"
:"A*BC*DEF*G****"使C
-------------------------------------------------------------------------
:main ,
fun ,
------------------------------------------------------------------------*/
#include <stdio.h>
void fun(char *a)
{
/**********Program**********/
/********** End **********/
}
main()
{
char s[81];
printf("【Enter a string:】\n");
gets(s);
fun(s);
printf("【The string after deleted:】\n");
puts(s);
}

View File

@ -0,0 +1,38 @@
/*-----------------------------------------------------------------------
-----------------------------------------------------------------------
3 25 37 2
: 1
: 100
23
-------------------------------------------------------------------------
:main ,
isMeetCondition ,
------------------------------------------------------------------------*/
#include <stdio.h>
int isMeetCondition(int num);
int main()
{
int start, end;
int i;
printf("【请输入区间的起始值: 】");
scanf("%d", &start);
printf("【请输入区间的结束值: 】");
scanf("%d", &end);
for (i = start; i <= end; i++)
{
if (isMeetCondition(i))
{
printf("%d\n", i);
}
}
return 0;
}
int isMeetCondition(int num)
{
/**********Program**********/
/********** End **********/
}

View File

@ -0,0 +1,42 @@
/*-----------------------------------------------------------------------
-----------------------------------------------------------------------
:abcdefg1234qwert
:4q
'4q''abcdefg1234qwert'
-------------------------------------------------------------------------
------------------------------------------------------------------------*/
#include <stdio.h>
#include <string.h>
// 函数声明,用于判断子字符串
int isSubstring(char *str1, char *str2);
int main()
{
char str1[100], str2[100];
printf("【请输入第一个字符串:】");
gets(str1);
printf("【请输入第二个字符串:】");
gets(str2);
if (isSubstring(str1, str2))
{
printf("字符串'%s'是字符串'%s'的子字符串\n", str2, str1);
}
else
{
printf("字符串'%s'不是字符串'%s'的子字符串\n", str2, str1);
}
return 0;
}
int isSubstring(char *str1, char *str2)
{
int len1 = strlen(str1);
int len2 = strlen(str2);
int i, j;
/**********Program**********/
/********** End **********/
return 0;
}

View File

@ -0,0 +1,29 @@
/*-----------------------------------------------------------------------
-------------------------------------------------------------------------
100
I will graduate from high school in June 2025
I will graduate from high school in June
-------------------------------------------------------------------------
------------------------------------------------------------------------*/
#include <stdio.h>
#include <string.h>
int main()
{
char a[100], b[100];
int l, i, j;
printf("【请输入字符串:】");
gets(a);
l = strlen(a);
j = 0;
/**********Program**********/
/********** End **********/
b[j] = '\0';
printf("【去掉数字后的字符串为:】");
puts(b);
return 0;
}

View File

@ -0,0 +1,32 @@
/*-----------------------------------------------------------------------
-------------------------------------------------------------------------
str 使
2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 7 7 7 7 7 7 7 7 8 8 9
2 3 4 5 6 7 8 9
-------------------------------------------------------------------------
------------------------------------------------------------------------*/
#include <stdio.h>
int del(int str[], int n)
{
int i, j = 1;
/**********Program**********/
/********** End **********/
}
int main()
{
int str[] = {2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 9};
int i, m, n = sizeof(str) / sizeof(int);
for (i = 0; i < n; i++)
printf("%d ", str[i]);
m = del(str, n);
printf("\n");
for (i = 0; i < m; i++)
printf("%d ", str[i]);
printf("\n");
return 1;
}