C语言谭浩强试题.pptVIP

  • 12
  • 0
  • 约 69页
  • 2017-02-16 发布于湖北
  • 举报
例1.3求两个整数中的较大者。 解题思路: 用一个函数实现求两个整数中的较大者 在主函数中调用此函数并输出结果 #include stdio.h int main( ) { int max(int x,int y); int a,b,c; scanf(”%d,%d”,a,b); c = max(a,b); printf(max=%d\n,c); return 0; } int max(int x,int y) { int z; if (x y) z = x; else z = y; return(z); } 主函数 max函数 #include stdio.h int main( ) { int max(int x,int y); int a,b,c; scanf(”%d,%d”,a,b); c = max(a,b); pri

文档评论(0)

1亿VIP精品文档

相关文档