Auto commit
This commit is contained in:
parent
4079ff9b07
commit
53b34d917f
@ -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");
|
||||||
|
@ -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;
|
temp = p[i];
|
||||||
while(i < j){
|
p[i] = p[j];
|
||||||
temp = p[i];
|
p[j] = temp;
|
||||||
p[i] = p[j];
|
|
||||||
p[j] = temp;
|
|
||||||
i++;
|
|
||||||
j--;
|
|
||||||
}
|
}
|
||||||
/********** End **********/
|
/********** End **********/
|
||||||
}
|
}
|
||||||
|
@ -38,14 +38,14 @@ int isSubstring(char *str1, char *str2)
|
|||||||
/**********Program**********/
|
/**********Program**********/
|
||||||
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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");
|
||||||
|
@ -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 **********/
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user