- 2
- 0
- 约2.07万字
- 约 95页
- 2019-09-29 发布于湖北
- 举报
例:从键盘输入一个大写字母,要求改用小写字母输出。#include stdio.h void main() { char c1, c2; c1 = getchar(); printf(“%c, %d\n”, c1, c1); c2 = c1 + 32; printf(“%c, %d\n”, c2, c2); } 运行情况:A↙A,65a,97 3.12 顺序结构示例 练习:求ax2+bx+c=0方程的根。 提示步骤:a,b,c由键盘输入,设 >0。众所周知,一元二次方程式的根为x1= x2= 可以将上面的分式分为两项:p= , q= x1=p+q, x2=p-q 3.12 顺序结构示例 #include stdio.h#include math.hvoid main ( ) { float a,b,c,disc,x1,x2,p,q; scanf(a=%f,b=%f,c=%f,a,b,c); disc=b*b-4*a*c; p=-b/(2*a); q=sqrt(disc)/(2*a); x1=p+q;x2=p-q; printf(\n\
原创力文档

文档评论(0)