![](https://lstatic.shangxueba.com/jiandati/pc/images/pc_jdt_tittleico.png)
下面代码的输出结果是a = [[1,2,3], [4,5,6], [7,8,9]]s = 0 for c in a: for j in range(3): s += c[j]print(s)
A.0
B.45
C.24
D.以上答案都不对
![](https://lstatic.shangxueba.com/jiandati/pc/images/jdt_q_ckda.png)
![](https://lstatic.shangxueba.com/jiandati/pc/images/jdt_panel_vip.png)
![](https://lstatic.shangxueba.com/jiandati/pc/images/jdt_q_wyda.png)
- · 有4位网友选择 D,占比40%
- · 有3位网友选择 B,占比30%
- · 有2位网友选择 C,占比20%
- · 有1位网友选择 A,占比10%
A.0
B.45
C.24
D.以上答案都不对
1)#include
2)using namespace std;
3)int main()
4){
5)int a,b,result;
6)cout<<"please input two numbers:"; 7)cin>>a>>b;
8)result=3*a-2*b+1;
9)cout<<"resultis
程序执行到第8行时,假设此时输入“4空格5”,则a的值是:()
A. 0
B. 4
C. 5
D. 不确定
B、1
C、15
D、16
1)#include< iostream >
2)# include< math.h >
3)using namespace std;
4)double max(double x,doubley);
5)void main()
6){
7)double a,b,c;
8)cout<< " input two numbers:"; 9)cin>>a>>b;
10)c=max(a,b);
11)cout<< " the squart of max imum="<< sqrt(c); 12)} 13)double max(doublex,doubley) 14){ 15)if(x>y)
16)returnx;
17)else
18)returny;
19)}
若执行第9行时,输入89后按回车,则执行完第10行后,c的值是:()
A. 8
B. 8.0(小数位数由编译器决定)
C. 9
D. 9.0(小数位数由编译器决定)
阅读以下说明和C++代码,将解答写入答题纸的对应栏内。
【说明】
请编写一个函数int SeqSearch(int list[],int start,int n,int key),该函数从start开始,在大小为n的数组list中查找key值,返回最先找到的key值的位置,如果没有找到则返回-1。请修改程序中画线部分的错误并将不同情况下的输出结果补充完整。
【程序】
文件search.cpp的内容如下:
#include
int SeqSearch(int list[],int start,int n,int key)
{
for(int i=start;i<=n;i++)// (1)
{
if(list[i]=key) // (2)
{
return i;
}
}
return -1;
}
void main()
{
int A[10];
int key,count=0,pos;
cout$amp;for(pos=0;pos<10;pos++)
{
cin$amp;>amp;$gt;A; // (3)
}
cout$amp;cin$amp;>amp;$gt;key;
pos=0;
while((pos=SeqSearch(A,pos,10,key))!=-1)
{
count++;
pos++;
}
cout$amp;}
第一种情况:输入2 3 12 6 8 45 8 33 7 输入key:8
输出: (4)
第二种情况:输入2 3 12 6 8 45 8 33 7 输入key:9
输出: (5)
1)#include< iostream >
2)#include< cmath >
3)using namespace std;
4)double max(double x,doubley)
5){
6)if(x>y)
7)return x;
8)else
9)return y;
10)}
11)int main()
12){
13)doublea,b,c;
14)cout<<" input two numbers:"; 15)cin >>a >>b;
16)c=max(a,b);
17)cout<<" the squart of max imum="<< sqrt( c ); 18)}
执行完第13行后,变量a的值是:()
A. 0
B. 1
C. 变量不存在
D. 随机值
【说明】
本程序的功能是生成螺旋方阵,用户可以输入该方阵的行列数,然后就生成对应的螺旋方阵。例如:当n=5时,对应的螺旋方阵如下:
1 16 15 14 13
2 17 24 23 12
3 18 25 22 11
4 19 20 21 10
5 6 7 8 9
【C++代码】
include"stdio.h"
include"iostream,h"
int array[11][11];
int temp;
int ROW;
void godown(int &m,int &a)
{
for(temp=1; temp<=ROW;temp++)
if(array[temp][a]==0)
array[temp][a]=(1);
a++;
}
void goright(int &m,int &b)
{
for(temp=1;temp<=ROW;temp++)
if(array[b][temp]==0)
array[b][temp]=m++;
b--;
}
void goup(int &m.int &c)
{
for(temp=ROW;temp>0;temp-)
if(array[temp][c]==0)
array[temp][c]=m++;
c--;
}
void goleft(int &m,int &d)
{
for(temp=ROW;temp>0;temp--)
if(array[d][temp]==0)
array[d][temp]=m++;
(2);
}
void main()
{
int a,b,c,d,max,m;
cin>>ROW;
cout>>end1;
for(a=1;a<=ROW;a++)
for(b=1;b<=ROW;b++)
(3);
m=1;
a=d=1;
b=c=ROW;
max=(4);
whiie(m<=max)
{
godown(m,a);
(5) (m,b);
goup(m,c);
goleft(m,d):
}
for(a=1;a<=ROW;a++)
{
for(b=1;b<=ROW;b++)
printf("%3d ",array[a][b]);
cout<<end1;
}
}
A、arr和p完全相同
B、*(p+i)和&arr [i]相等
C、*(p+4)与arr [4]相等
D、arr++表示arr [1]的地址
为了保护您的账号安全,请在“简答题”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!