for循环得到的值怎么改变数组的键值 5
$code_arr=array('page'=>1,'pageSize'=>50)for($i=1;$i<=3;$i++){echo"\$code_arr['page']...
$code_arr= array(
'page'=>1,
'pageSize' =>50
)
for($i=1;$i<=3;$i++){
echo "\$code_arr['page']=".$i.';<br />';
}
各位大虾 请问怎么用for循环得到的值修改数组中的值呢 展开
'page'=>1,
'pageSize' =>50
)
for($i=1;$i<=3;$i++){
echo "\$code_arr['page']=".$i.';<br />';
}
各位大虾 请问怎么用for循环得到的值修改数组中的值呢 展开
若以下回答无法解决问题,邀请你更新回答
展开全部
//修改后的程序
import java.util.*;
public class Page188{
public static void main(String[] args) {
System.out.println("请输入4位学员的成绩:");
int[] score=new int[5];
int <a href="https://www.baidu.com/s?wd=num&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1Y4nhfsnjPBnWI9uWD3mhR30ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6K1TL0qnfK1TL0z5HD0IgF_5y9YIZ0lQzqlpA-bmyt8mh7GuZR8mvqVQL7dugPYpyq8Q1RvnHcdnHDkn0" target="_blank" class="baidu-highlight">num</a> = 0;
Scanner input=new Scanner(System.in);
for(int i = 0; i < score.length; i++){
System.out.println("请输入第"+(i+1)+"位同学的成绩");
score[i] = input.nextInt();
<a href="https://www.baidu.com/s?wd=num&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1Y4nhfsnjPBnWI9uWD3mhR30ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6K1TL0qnfK1TL0z5HD0IgF_5y9YIZ0lQzqlpA-bmyt8mh7GuZR8mvqVQL7dugPYpyq8Q1RvnHcdnHDkn0" target="_blank" class="baidu-highlight">num</a> += score[i];
}
System.out.println("成绩相加后的值:" + <a href="https://www.baidu.com/s?wd=num&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1Y4nhfsnjPBnWI9uWD3mhR30ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6K1TL0qnfK1TL0z5HD0IgF_5y9YIZ0lQzqlpA-bmyt8mh7GuZR8mvqVQL7dugPYpyq8Q1RvnHcdnHDkn0" target="_blank" class="baidu-highlight">num</a>);
}
}
import java.util.*;
public class Page188{
public static void main(String[] args) {
System.out.println("请输入4位学员的成绩:");
int[] score=new int[5];
int <a href="https://www.baidu.com/s?wd=num&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1Y4nhfsnjPBnWI9uWD3mhR30ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6K1TL0qnfK1TL0z5HD0IgF_5y9YIZ0lQzqlpA-bmyt8mh7GuZR8mvqVQL7dugPYpyq8Q1RvnHcdnHDkn0" target="_blank" class="baidu-highlight">num</a> = 0;
Scanner input=new Scanner(System.in);
for(int i = 0; i < score.length; i++){
System.out.println("请输入第"+(i+1)+"位同学的成绩");
score[i] = input.nextInt();
<a href="https://www.baidu.com/s?wd=num&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1Y4nhfsnjPBnWI9uWD3mhR30ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6K1TL0qnfK1TL0z5HD0IgF_5y9YIZ0lQzqlpA-bmyt8mh7GuZR8mvqVQL7dugPYpyq8Q1RvnHcdnHDkn0" target="_blank" class="baidu-highlight">num</a> += score[i];
}
System.out.println("成绩相加后的值:" + <a href="https://www.baidu.com/s?wd=num&tn=44039180_cpr&fenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1Y4nhfsnjPBnWI9uWD3mhR30ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6K1TL0qnfK1TL0z5HD0IgF_5y9YIZ0lQzqlpA-bmyt8mh7GuZR8mvqVQL7dugPYpyq8Q1RvnHcdnHDkn0" target="_blank" class="baidu-highlight">num</a>);
}
}
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询