/*
PE 9-1
设计一个函数min(x, y),返回两个double类型值的较小值,在一个简单的驱动程序中测试该函数
*/
#include <stdio.h>
double min(double a, double b);
int main(void)
{
printf("The min number between 1 and 5 is %.2f \n", min(1.0, 2.0));
return 0;
}
double min(double a, double b)
{
return a <= b ? a : b;
}
/*
PE 9-2
设计一个函数chline(ch, j, i),打印指定的字符j行i列(书又翻译错了)
原文that prints the requested character in columns i through j .
在一个简单的驱动程序中测试该函数。
*/
#include <stdio.h>
void chline(char ch, int row, int col);
int main(void)
{
chline('*', 3, 5);
return 0;
}
void chline(char ch, int row, int col)
{
for (int i = 1; i <= row; i++)
{
for (int j = 1; j <= col; j++)
putchar(ch);
putchar('\n');
}
return;
}
/*
PE 9-3
编写一个函数,接受三个参数,一个字符和两个整数。
字符参数是待打印的字符,第1个整数指定一行中打印字符的次数,
第2个整数指定打印指定字符的行数。编写一个调用该程序的函数。
注意:第1个参数是列数,第2个参数是行数
*/
#include <stdio.h>
int main(void)
{
print_ch('#', 3, 4);
return 0;
}
void print_ch(char ch, int col, int row)
{
for (int i = 1; i <= row; i++)
{
for (int j = 1; j <= col; j++)
putchar(ch);
putchar('\n');
}
return;
}
9.11编程练习/*PE 9-1设计一个函数min(x, y),返回两个double类型值的较小值,在一个简单的驱动程序中测试该函数*/#include &amp;amp;amp;amp;amp;lt;stdio.h&amp;amp;amp;amp;amp;gt;double min(double a, double b);int main(void){ printf(&amp;amp;amp;amp;quot;The min number between