c语言第3章课件.先ppt.pptVIP

  • 4
  • 0
  • 约8.29千字
  • 约 59页
  • 2019-01-01 发布于福建
  • 举报
c语言第3章课件.先ppt

#include stdio.h main( ) { float x=0,y=0; scanf(%f,x); if( x=0 ) y=x+1; if( x0 x=1 ) y=1; if( x1 ) y=x; printf(x=%f,y=%f\n, x,y); } 第1次运行: 3? x=3.000000,y=3.000000 if( x1 ) y=x; 第2次运行: -1? x=0.500000,y=1.000000 if( x=0 ) y=x+1; 第3次运行: 0.5? if( x0 x=1 ) y=1; x=-1.000000,y=0.000000 必须调试所有可能情况 【例3.6】输入3个整数,输出其中最大数。 输入a、b、c的值 max=a max=b maxb? 真 假 maxc? max=c 真 假 输出max的值 #include stdio.h main( ) { int a=0,b=0,c=0,max=0; printf(Input a,b,c:); scanf(%d%d%d,a,b,c); max=a; if ( maxb ) max=b; if ( maxc ) max=c; printf(%d,%d,%d,

文档评论(0)

1亿VIP精品文档

相关文档