//声明
int a[10] = {0,1,2,3,4,5,6,7,8,9};
int i = 0;
int temp = 0;
printf("请输入要修改的数据! 如 9\n");
scanf("%d",&temp);
//查找
for(i = 0; i < 10; i++)
{
if( a[i] == temp)
{
printf("亲~请输入新的数据! 呵呵!\n");
scanf("%d",&a[i]);
printf("数据修改完毕!\n");
}
}
//遍历
for(i = 0; i < 10; i++)
{
printf("a[%d] = %d\n",i,a[i]);
} |
|