C语言程序设计第3章选择结构程序设计课件教学.pptVIP

  • 18
  • 0
  • 约1.32万字
  • 约 60页
  • 2017-01-01 发布于广东
  • 举报

C语言程序设计第3章选择结构程序设计课件教学.ppt

PPT研究院 POWERPOINT ACADEMY * * 程序如下: #include stdio.h main ( ) { int x , y ; printf ( Enter an integer : ) ; scanf (%d , x ) ; y = x ; if ( y 0 ) y = - y ; printf ( \n integer : %d absolute value: %d \n , x , y ) ; } 运行程序,显示:Enter an integer : 输入:-12? 输出:integer : -12 absolute value : 12 【例3.9】从键盘输入任意一个整数,求其绝对值并输出。 程序2:(使用单分支if语句形式。先假设a的值较大,将其赋给max,然后用max与b进行判断,如果maxb,再将b的值赋给max) #include stdio.h main ( ) { int a,b,max ; printf( Input two numbers : ) ; scanf(%d , %d , a , b ) ; max = a ; if(maxb) max = b ; printf(The max number is

文档评论(0)

1亿VIP精品文档

相关文档