将WHILE LOOP转换为FUNCTIONS [英] Converting WHILE LOOP into FUNCTIONS

查看:74
本文介绍了将WHILE LOOP转换为FUNCTIONS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!:)我再次需要你的帮助..我得到了一个while循环程序的代码,我们的教授让我们把它转换成函数。请有人帮帮我。它必须转换为3种类型。


1.无效

2.无效但带参数

3. w / out void但返回值


这里是代码:


1 #include< stdio.h>

2 #include< ; iostream.h>

3 #include< conio.h>

4

5 int main(无效)

6

7 {

8

9 int i,j;

10 i = 0;

11 while(i< = 4){

12 j = 0;

13 while(j< = 4){

14 j ++;

15}

16 i ++;

17}

18 i ++;

19 printf("%d",i * j);

20

21返回0;

22}


我已经运行此程序,输出为30.我非常感谢大家的帮助。非常感谢

Hello everyone!:) i need your help again..i got there a code of a while loop program and our prof let us convert it into functions. can anyone help me please. It must be converted into 3 types.

1. void only
2. void but with parameter
3. w/out void but with return value

Here''s the code:

1 #include <stdio.h>
2 #include <iostream.h>
3 #include <conio.h>
4
5 int main(void)
6
7 {
8
9 int i, j;
10 i=0;
11 while (i<=4) {
12 j=0;
13 while (j<=4) {
14 j++;
15 }
16 i++;
17 }
18 i++;
19 printf("%d", i*j);
20
21 return 0;
22 }

I run this program already and the output is 30. I really appreciate your help everyone. Thank you very much

推荐答案


各位大家好!:)我再次需要你的帮助..我找到了一个代码一个while循环程序和我们的教授让我们将其转换为函数。请有人帮帮我。它必须转换为3种类型。


1.无效

2.无效但带参数

3. w / out void但返回值


这里是代码:


1 #include< stdio.h>

2 #include< ; iostream.h>

3 #include< conio.h>

4

5 int main(无效)

6

7 {

8

9 int i,j;

10 i = 0;

11 while(i< = 4){

12 j = 0;

13 while(j< = 4){

14 j ++;

15}

16 i ++;

17}

18 i ++;

19 printf("%d",i * j);

20

21返回0;

22}


我已经运行此程序,输出为30.我非常感谢大家的帮助。非常感谢
Hello everyone!:) i need your help again..i got there a code of a while loop program and our prof let us convert it into functions. can anyone help me please. It must be converted into 3 types.

1. void only
2. void but with parameter
3. w/out void but with return value

Here''s the code:

1 #include <stdio.h>
2 #include <iostream.h>
3 #include <conio.h>
4
5 int main(void)
6
7 {
8
9 int i, j;
10 i=0;
11 while (i<=4) {
12 j=0;
13 while (j<=4) {
14 j++;
15 }
16 i++;
17 }
18 i++;
19 printf("%d", i*j);
20
21 return 0;
22 }

I run this program already and the output is 30. I really appreciate your help everyone. Thank you very much



其中一个例子就是创建一个返回i和j的产品的函数

An example of one of these would be to create a function that returns the product of i and j

展开 | 选择 | Wrap | 行号


谢谢你的帮助女士:)但是如果只有void而且参数是什么?有什么想法吗?
Thanks for that help madam :) but how about for the void only and void with parameter? got any ideas?



感谢你的帮助女士:)但是如果只有void而且参数是什么?有什么想法吗?
Thanks for that help madam :) but how about for the void only and void with parameter? got any ideas?



只有void的函数不带参数,什么都不返回

A void only function takes no parameters and returns nothing

展开 | < span class =codeLinkonclick =selectAll(this);>选择 | Wrap | 行号


这篇关于将WHILE LOOP转换为FUNCTIONS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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