Auto commit

This commit is contained in:
smallkun 2025-04-01 18:56:19 +08:00
parent 4079ff9b07
commit 53b34d917f
5 changed files with 24 additions and 20 deletions

View File

@ -20,11 +20,11 @@ int main()
int money = 100; int money = 100;
int year = 1; int year = 1;
/**********Program**********/ /**********Program**********/
while(money > 0){ do{
money = money + money*0.04; money = money *(1+0.04);
money-=10; money-=10;
year++; year++;
} }while(money > 0);
/********** End **********/ /********** End **********/
printf("%d 年后账户上的钱会被花完", year); printf("%d 年后账户上的钱会被花完", year);
printf("\n"); printf("\n");

View File

@ -31,14 +31,10 @@ void sort(int *p, int n)
{ {
int i, j, temp; int i, j, temp;
/**********Program**********/ /**********Program**********/
i = 0; for(i=0,j=n-1;i<j;i++,j--){
j = n-1;
while(i < j){
temp = p[i]; temp = p[i];
p[i] = p[j]; p[i] = p[j];
p[j] = temp; p[j] = temp;
i++;
j--;
} }
/********** End **********/ /********** End **********/
} }

View File

@ -39,13 +39,13 @@ int isSubstring(char *str1, char *str2)
for(i=0;i<len1;i++){ for(i=0;i<len1;i++){
j=0; j=0;
while(str1[i] == str2[j]&&str2[j] != '\0'){ while(str1[i] == str2[j]&&str2[j] != '\0'){
i++;
j++; j++;
i++;
} }
if(j != 0){ if(j != len2){
i-=j; i-=j;
} }
if(str2[j] == '\0'){ if(j == len2){
return 1; return 1;
} }
} }

View File

@ -20,7 +20,11 @@ int main()
int money = 100; int money = 100;
int year = 1; int year = 1;
/**********Program**********/ /**********Program**********/
do{
money = money *(1+0.04);
money-=10;
year++;
}while(money > 0);
/********** End **********/ /********** End **********/
printf("%d 年后账户上的钱会被花完", year); printf("%d 年后账户上的钱会被花完", year);
printf("\n"); printf("\n");

View File

@ -31,6 +31,10 @@ void sort(int *p, int n)
{ {
int i, j, temp; int i, j, temp;
/**********Program**********/ /**********Program**********/
for(i=0,j=n-1;i<j;i++,j--){
temp = p[i];
p[i] = p[j];
p[j] = temp;
}
/********** End **********/ /********** End **********/
} }