C语言上机150道题 下载本文

{ printf(\ printf(\ } else

printf(\ getch(); } 31

#include #include #include main() {

double a,b,c; double s,x1,x2;

printf(\ scanf(\ if(a>=-(1e-6)&&a<=(1e-6))

printf(\ else {

s=b*b-4*a*c; if(s>(1e-6)) {

x1=(-b+sqrt(s))/(2*a); x2=(-b-sqrt(s))/(2*a);

printf(\ else

if(s>=-(1e-6)&&s<=(1e-6)) {

x1=x2=-b/(2*a);

printf(\ } else { s=-s; x1=-b/(2*a);

x2=fabs(sqrt(s)/(2*a));

printf(\

printf(\ } }

getch(); } 32

#include #include main() {

int score, temp,logic; char grade; logic=1; while(logic) {

printf(\ scanf(\ if((score>100)||(score<0)) printf(\ else logic=0; printf(\ }

if(score==100) temp=9;

else

temp=(score-score)/10; switch(temp) {

case 9:grade='A';break; case 8:grade='B';break; case 7:grade='C';break; case 6:grade='d';break; case 5: case 4: case 3: case 2: case 1:

case 0:grade='e';break; }

printf(\

system(\} 33

#include