Auto commit
This commit is contained in:
parent
4079ff9b07
commit
53b34d917f
@ -20,11 +20,11 @@ int main()
|
||||
int money = 100;
|
||||
int year = 1;
|
||||
/**********Program**********/
|
||||
while(money > 0){
|
||||
money = money + money*0.04;
|
||||
money -= 10;
|
||||
do{
|
||||
money = money *(1+0.04);
|
||||
money-=10;
|
||||
year++;
|
||||
}
|
||||
}while(money > 0);
|
||||
/********** End **********/
|
||||
printf("%d 年后账户上的钱会被花完", year);
|
||||
printf("\n");
|
||||
|
@ -31,14 +31,10 @@ void sort(int *p, int n)
|
||||
{
|
||||
int i, j, temp;
|
||||
/**********Program**********/
|
||||
i = 0;
|
||||
j = n-1;
|
||||
while(i < j){
|
||||
for(i=0,j=n-1;i<j;i++,j--){
|
||||
temp = p[i];
|
||||
p[i] = p[j];
|
||||
p[j] = temp;
|
||||
i++;
|
||||
j--;
|
||||
}
|
||||
/********** End **********/
|
||||
}
|
||||
|
@ -38,14 +38,14 @@ int isSubstring(char *str1, char *str2)
|
||||
/**********Program**********/
|
||||
for(i=0;i<len1;i++){
|
||||
j=0;
|
||||
while(str1[i] == str2[j] && str2[j] != '\0'){
|
||||
i++;
|
||||
while(str1[i] == str2[j]&&str2[j] != '\0'){
|
||||
j++;
|
||||
i++;
|
||||
}
|
||||
if(j != 0){
|
||||
if(j != len2){
|
||||
i-=j;
|
||||
}
|
||||
if(str2[j] == '\0'){
|
||||
if(j == len2){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,11 @@ int main()
|
||||
int money = 100;
|
||||
int year = 1;
|
||||
/**********Program**********/
|
||||
|
||||
do{
|
||||
money = money *(1+0.04);
|
||||
money-=10;
|
||||
year++;
|
||||
}while(money > 0);
|
||||
/********** End **********/
|
||||
printf("%d 年后账户上的钱会被花完", year);
|
||||
printf("\n");
|
||||
|
@ -31,6 +31,10 @@ void sort(int *p, int n)
|
||||
{
|
||||
int i, j, temp;
|
||||
/**********Program**********/
|
||||
|
||||
for(i=0,j=n-1;i<j;i++,j--){
|
||||
temp = p[i];
|
||||
p[i] = p[j];
|
||||
p[j] = temp;
|
||||
}
|
||||
/********** End **********/
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user