Auto commit

This commit is contained in:
smallkun 2025-04-01 16:27:10 +08:00
parent 49499ddb60
commit fc66b14900
4 changed files with 171 additions and 0 deletions

View File

@ -0,0 +1,53 @@
/*----------------------------------------------------------------------
------------------------------------------------------------------------
C []
[nx]n x x n [nxy]
n xy xy n fun
1
[5wh]
whwhwhwhwh
------------------------------------------------------------------------
`main`
Program-End
Program-End
----------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char *fun(char input[])
{
int len = strlen(input);
char *output = (char *)malloc(1000 * sizeof(char));
if (output == NULL)
{
printf("内存分配失败!\n");
return NULL;
}
int outputIndex = 0;
/**********Program**********/
int i;
for(i=0;i<len;i++){
while(input[i]=='['){
}
}
/********** End **********/
return output;
}
int main()
{
char input[1000];
printf("【请输入符合规则的字符串:】\n");
scanf("%s", input);
char *result = fun(input);
if (result != NULL)
{
printf("【原始字符串:】%s\n", result);
free(result);
}
return 0;
}

View File

@ -0,0 +1,54 @@
/*-----------------------------------------------------------------------
-----------------------------------------------------------------------
: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**********/
for(i=0;i<len1;i++){
j=0;
while(str1[i] == str2[j] && str2[j] != '\0'){
i++;
j++;
}
if(j != 0){
i-=j;
}
if(str2[j] == '\0'){
return 1;
}
}
/********** End **********/
return 0;
}

View File

@ -0,0 +1,28 @@
/*---------------------------------------------------------------------
---------------------------------------------------------------------
100
4%10
(使do....while)
---------------------------------------------------------------------
main
Program-End
Program-End
---------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
int main()
{
int money = 100;
int year = 1;
/**********Program**********/
/********** End **********/
printf("%d 年后账户上的钱会被花完", year);
printf("\n");
return 0;
}

View File

@ -0,0 +1,36 @@
/*---------------------------------------------------------------------
---------------------------------------------------------------------
20 24 4 13 11
11 13 4 24 20
---------------------------------------------------------------------
main
Program-End
Program-End
---------------------------------------------------------------------*/
#include <stdio.h>
void sort(int *, int);
void main()
{
int a[5], i;
for (i = 0; i < 5; i++)
{
scanf("%d,", &a[i]);
}
sort(a, 5);
for (i = 0; i < 5; i++)
{
printf("%d ", a[i]);
}
printf("\n");
}
void sort(int *p, int n)
{
int i, j, temp;
/**********Program**********/
/********** End **********/
}