#include <stdio.h>
main(){
double x[]={10,20,50,9,8,100,33},x0=0,x1=0;
int i=0,n=0,i0=0;
n=sizeof(x)/sizeof(double);
printf("old value,new value=");
scanf("%lf %lf",&x0,&x1);
for(i=0;i<n;i++){
if(x[i]==x0){
i0=i;
break;
}
}//可能没有找到,x0=0.
printf("before updata:\n");
for(i=0;i<n;i++){
printf("%6.1lf",x[i]);
}
if((i0<n)&&(x0==x[i0])){
printf("\nthe update number is:%lf,the position:%d\n",x0,i0);
x[i0]=x1;
}
else{
printf("not found!");
}
printf("after update:\n");
for(i=0;i<n;i++){
printf("%6.1lf",x[i]);
}
printf("\n");
}