我的代码问题..... [英] problem with my code.....

查看:55
本文介绍了我的代码问题.....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我在下面编写的代码,但我可以弄清楚在我的代码运行时第21行的

赋值语句会执行多少次?

13 void f1(int a []){

14 int x,y;

15 int t;

16 for(x = 1; x< 10; x ++){

17 if(a [x] = a [x - 1]){

18 t = a [x];

19 y = x;

20 do {

21 a [y] = a [y - 1];

22 y-- ;

23} while(y 0&& a [y - 1] t);

24 a [y] = t;

25}

26}

27返回;

28}

29 int main(int argc, char ** argv)

30 {

31 int a [10];

32 char回复;

33 for(int i = 0; i< 10; i ++)a [i] = 100 - i;

34 f1(a);

35 for(int i = 0; i< 10; i ++)cout << i<< " ;. " << a [i]<< endl;

here is my code written below but i could figure out howmany times the
assignment statement at Line 21 execute when my code run?
13 void f1(int a[]) {
14 int x, y;
15 int t;
16 for(x = 1; x < 10; x++) {
17 if(a[x] = a[x - 1]) {
18 t = a[x];
19 y = x;
20 do {
21 a[y] = a[y - 1];
22 y--;
23 } while (y 0 && a[y - 1] t);
24 a[y] = t;
25 }
26 }
27 return;
28 }
29 int main (int argc, char **argv)
30 {
31 int a[10];
32 char reply;
33 for (int i = 0; i < 10; i++) a[i] = 100 - i;
34 f1(a);
35 for (int i = 0; i < 10; i++) cout << i << ". " << a[i] << endl;

推荐答案

ia ************* @ gmail.com 写道:

这是我在下面写的代码但我可以弄清楚,当我的代码运行时,第21行的

赋值语句会执行多少次?
here is my code written below but i could figure out howmany times the
assignment statement at Line 21 execute when my code run?



添加一个计数器。

Add a counter.


>

13 void f1(int a []){

14 int x,y;

15 int t;

16 for(x = 1; x< 10; x ++){

17 if(a [x] = a [x - 1]){

18 t = a [x];

19 y = x;

20 do {

21 [y] = a [y - 1];

22 y--;

23} while(y 0&& ; a [y - 1] t);

24 a [y] = t;

25}

26}

27返回;

28}

29 int main(int argc,char ** argv)

30 {

31 int a [10];

32 char回复;

33 for(int i = 0; i< 10; i ++)a [i ] = 100 - i;

34 f1(a);

35 for(int i = 0; i< 10; i ++)cout<< i<< " ;. " << a [i]<< endl;
>
13 void f1(int a[]) {
14 int x, y;
15 int t;
16 for(x = 1; x < 10; x++) {
17 if(a[x] = a[x - 1]) {
18 t = a[x];
19 y = x;
20 do {
21 a[y] = a[y - 1];
22 y--;
23 } while (y 0 && a[y - 1] t);
24 a[y] = t;
25 }
26 }
27 return;
28 }
29 int main (int argc, char **argv)
30 {
31 int a[10];
32 char reply;
33 for (int i = 0; i < 10; i++) a[i] = 100 - i;
34 f1(a);
35 for (int i = 0; i < 10; i++) cout << i << ". " << a[i] << endl;



-

Ian Collins。


--
Ian Collins.


3月22日,下午4:00,Ian Collins< ian-n ... @ hotmail.comwrote:
On Mar 22, 4:00 pm, Ian Collins <ian-n...@hotmail.comwrote:

ianenis.tiry ... @ gmail.com写道:
ianenis.tiry...@gmail.com wrote:

这里是我的代码,但我可以弄清楚在我的代码运行时第21行的

赋值语句会执行多少次?
here is my code written below but i could figure out howmany times the
assignment statement at Line 21 execute when my code run?



添加一个计数器。


Add a counter.


13 void f1(int a []){

14 int x,y;

15 int t;

16 for(x = 1; x< 10; x ++){

17如果(a [x] = a [x - 1]){

18 t = a [x];

19 y = x;

20做{

21 a [y] = a [y - 1];

22 y--;

23} while(y 0&& a [y - 1] t);

24 a [y] = t;

25}

26}

27返回;

28}

29 int main(int argc,char ** argv)

30 {

31 int a [10];

32 char回复;

33 for(int i = 0; i< 10; i ++)a [i] = 100 - i;

34 f1(a);

35 for(int i = 0; i< 10 ; i ++)cout<< i<< " ;. " << a [i]<< ENDL;
13 void f1(int a[]) {
14 int x, y;
15 int t;
16 for(x = 1; x < 10; x++) {
17 if(a[x] = a[x - 1]) {
18 t = a[x];
19 y = x;
20 do {
21 a[y] = a[y - 1];
22 y--;
23 } while (y 0 && a[y - 1] t);
24 a[y] = t;
25 }
26 }
27 return;
28 }
29 int main (int argc, char **argv)
30 {
31 int a[10];
32 char reply;
33 for (int i = 0; i < 10; i++) a[i] = 100 - i;
34 f1(a);
35 for (int i = 0; i < 10; i++) cout << i << ". " << a[i] << endl;



-

Ian Collins.-隐藏引用的文字 -


- 显示引用的文字 -


--
Ian Collins.- Hide quoted text -

- Show quoted text -



i不明白Ian Collins是什么意思?请它是

紧急我需要打电话给这个作业然后把它打开......帮我!!!!

i didnt understand what does that mean Ian Collins? please it is
urgent i need to ork on this assignment and turn it in... help me!!!!


ia*************@gmail.com 写道:

3月22日下午4:00,Ian Collins< ian-n ... @ hotmail.comwrote:
On Mar 22, 4:00 pm, Ian Collins <ian-n...@hotmail.comwrote:

>> ianenis.tiry ... @ gmail.com写道:
>>ianenis.tiry...@gmail.com wrote:

>>>这是我的代码写下面,但我可以弄清楚,当我的代码运行时,第21行的
赋值语句会执行多少次?
>>>here is my code written below but i could figure out howmany times the
assignment statement at Line 21 execute when my code run?


添加一个柜台。


Add a counter.



*请*不要引用签名。

*Please* don''t quote signatures.


>


我不明白Ian Collins是什么意思?请它是

紧急我需要在这个任务上打开并将其打开...帮助我!!!!
>

i didnt understand what does that mean Ian Collins? please it is
urgent i need to ork on this assignment and turn it in... help me!!!!



一个变量计算生产线的执行次数。


不要把作业留到最后一刻!


-

Ian Collins。

A variable to count the number of times the line is executed.

Don''t leave your homework to the last moment!

--
Ian Collins.


这篇关于我的代码问题.....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆