/*2-7.编写一个程序,程序中要调用名为 one_three()的函数。该函数要在一行中显示单词"one",
再调用 two()函数,然后再在另一行中显示单词"three"。函数 two()应该能在一行中显示单词"two"。 main()
函数应该在调用 one_three()函数之前显示短语"starting now:",函数调用之后要显示"done!"o 这样,
最后的输出结果应如下所示:
starting now
one
two
three
done !*/
#include <stdio.h>
void one_three(void);
void two(void);
int main()
{
printf("starting now\n");
one_three();
printf("done!\n");
system("pause");
return 0;
}
void one_three(void)
{
printf("one\n");
two();
printf("three\n");
}
void two(void)
{
printf("two\n");
}
C Primer Plus2-7
最新推荐文章于 2022-12-12 22:04:13 发布
本文介绍了一个简单的C语言程序示例,演示了如何通过函数调用来实现特定的功能输出。程序包括三个函数:one_three(), two() 和 main()。其中 one_three() 函数负责输出one和three,并在两者之间调用 two() 函数来输出two。main() 函数则负责程序的整体流程控制。
1200

被折叠的 条评论
为什么被折叠?



