达美航空

实验三

淺唱寂寞╮ 提交于 2019-12-04 21:55:28
// 一元二次方程求解 // 重复执行, 直到按Ctrl+D或Ctrl+E结束 // #include <math.h> #include <stdio.h> #include <stdlib.h> int main() { float a, b, c, x1, x2; float delta, real, imag; printf("Enter a, b, c: "); while(scanf("%f%f%f", &a, &b, &c)) { if(a == 0) printf("not quadratic equation.\n"); else { delta = b*b - 4*a*c; if(delta >= 0) { x1 = (-b + sqrt(delta)) / (2*a); x2 = (-b - sqrt(delta)) / (2*a); printf("x1 = %f, x2 = %f\n", x1, x2); } else { real = -b/(2*a); imag = sqrt(-delta) / (2*a); printf("x1 = %f + %fi, x2 = %f - %fi\n", real, imag, real, imag); } } printf("Enter a, b, c:\n"); } system("pause"); return

实验三

*爱你&永不变心* 提交于 2019-12-04 21:54:48
实验三 #include <stdio.h> #include <stdlib.h> #include <time.h> int main() { int guessNumber; int ans; srand((time(0))); guessNumber = 1 + rand()%100; do { printf("your guess number is(1~100): "); scanf("%d", &ans); if(ans < guessNumber) printf("%d is lower than the number.\n", ans); else if(ans > guessNumber) printf("%d higher then the number.\n", ans); }while(ans != guessNumber); printf("Congratulations. you hit it~\n"); system("pause"); return 0; } #include <stdio.h> #include <stdlib.h> #include <time.h> int main() { int guessNumber; int ans; srand((time(0))); guessNumber = 1 + rand()%100; do

实验三

我们两清 提交于 2019-12-04 21:04:49
#include <math.h> #include <stdio.h> #include <stdlib.h> int main() { float a, b, c, x1, x2; float delta, real, imag; printf("Enter a, b, c: "); while(scanf("%f%f%f", &a, &b, &c)) { if(a == 0) printf("not quadratic equation.\n"); else { delta = b*b - 4*a*c; if(delta >= 0) { x1 = (-b + sqrt(delta)) / (2*a); x2 = (-b - sqrt(delta)) / (2*a); printf("x1 = %f, x2 = %f\n", x1, x2); } else { real = -b/(2*a); imag = sqrt(-delta) / (2*a); printf("x1 = %f + %fi, x2 = %f - %fi\n", real, imag, real, imag); } } printf("Enter a, b, c:\n"); } system("pause"); return 0; } #include <stdio.h> #include <stdlib.h

实验3

女生的网名这么多〃 提交于 2019-12-04 20:58:02
// 一元二次方程求解 // 重复执行, 直到按Ctrl+D或Ctrl+E结束 // #include <math.h> #include <stdio.h> #include <stdlib.h> int main() { float a, b, c, x1, x2; float delta, real, imag; printf("Enter a, b, c: "); while(scanf("%f%f%f", &a, &b, &c)) { if(a == 0) printf("not quadratic equation.\n"); else { delta = b*b - 4*a*c; if(delta >= 0) { x1 = (-b + sqrt(delta)) / (2*a); x2 = (-b - sqrt(delta)) / (2*a); printf("x1 = %f, x2 = %f\n", x1, x2); } else { real = -b/(2*a); imag = sqrt(-delta) / (2*a); printf("x1 = %f + %fi, x2 = %f - %fi\n", real, imag, real, imag); } } printf("Enter a, b, c:\n"); } system("pause"); return

实验3

给你一囗甜甜゛ 提交于 2019-12-04 20:15:31
#include <stdio.h> #include <stdlib.h> #include <time.h> int main() { int guessNumber; // 存放程序运行时生成的1~100之间的随机整数 int ans; // 存放用户猜的数字 srand((time(0))); // 以时间函数作为随机种子 guessNumber = 1 + rand()%100; // 生成1~100之间的随机数 do { printf("your guess number is(1~100): "); scanf("%d", &ans); if(ans < guessNumber) printf("%d is lower than the number.\n", ans); else if(ans > guessNumber) printf("%d higher then the number.\n", ans); }while(ans != guessNumber); printf("Congratulations. you hit it~\n"); return 0; } // 一元二次方程求解 // 重复执行, 直到按Ctrl+D或Ctrl+E结束 // #include <math.h> #include <stdio.h> #include <stdlib.h

实验三

二次信任 提交于 2019-12-04 20:14:09
Part1: 一元二次方程求解 #include <math.h> #include <stdio.h> #include <stdlib.h> int main() { float a, b, c, x1, x2; float delta, real, imag; printf("Enter a, b, c: "); while(scanf("%f%f%f", &a, &b, &c)) { if(a == 0) printf("not quadratic equation.\n"); else { delta = b*b - 4*a*c; if(delta >= 0) { x1 = (-b + sqrt(delta)) / (2*a); x2 = (-b - sqrt(delta)) / (2*a); printf("x1 = %f, x2 = %f\n", x1, x2); } else { real = -b/(2*a); imag = sqrt(-delta) / (2*a); printf("x1 = %f + %fi, x2 = %f - %fi\n", real, imag, real, imag); } } printf("Enter a, b, c:\n"); } system("pause"); return 0; } 猜数游戏 #include <stdio

实验三

隐身守侯 提交于 2019-12-04 17:37:25
/* 编程找出5个整数的最大数和最小数 《C语言程序设计教程学习指导》p122实验内容(3) */ #include <stdio.h> #include <stdlib.h> int main() { int number, max, min, n; n=1; printf("输入第%d个数: ", n); scanf("%d", &number); max = number; min = number; while(n<5) { n++; printf("输入第%d个数: ", n); scanf("%d", &number); if(max<number) max = number; else if(min>number) min = number; } printf("最大数为: %d\n", max); printf("最小数为: %d\n", min); system("pause"); return 0; } // 一元二次方程求解 // 重复执行, 直到按Ctrl+D或Ctrl+E结束 // #include <math.h> #include <stdio.h> #include <stdlib.h> int main() { float a, b, c, x1, x2; float delta, real, imag; printf("Enter a, b, c

实验3

喜你入骨 提交于 2019-12-04 16:34:36
// 一元二次方程求解 // 重复执行, 直到按Ctrl+D或Ctrl+E结束 // #include <math.h> #include <stdio.h> #include <stdlib.h> int main() { float a, b, c, x1, x2; float delta, real, imag; printf("Enter a, b, c: "); while(scanf("%f%f%f", &a, &b, &c)) { if(a == 0) printf("not quadratic equation.\n"); else { delta = b*b - 4*a*c; if(delta >= 0) { x1 = (-b + sqrt(delta)) / (2*a); x2 = (-b - sqrt(delta)) / (2*a); printf("x1 = %f, x2 = %f\n", x1, x2); } else { real = -b/(2*a); imag = sqrt(-delta) / (2*a); printf("x1 = %f + %fi, x2 = %f - %fi\n", real, imag, real, imag); } } printf("Enter a, b, c:\n"); } system("pause"); return

实验3作业

点点圈 提交于 2019-12-04 16:30:48
Part 1.1 / 一元二次方程求解 // 重复执行, 直到按Ctrl+D或Ctrl+E结束 // #include <math.h> #include <stdio.h> #include <stdlib.h> int main() { float a, b, c, x1, x2; float delta, real, imag; printf("Enter a, b, c: "); while(scanf("%f%f%f", &a, &b, &c)) { if(a == 0) printf("not quadratic equation.\n"); else { delta = b*b - 4*a*c; if(delta >= 0) { x1 = (-b + sqrt(delta)) / (2*a); x2 = (-b - sqrt(delta)) / (2*a); printf("x1 = %f, x2 = %f\n", x1, x2); } else { real = -b/(2*a); imag = sqrt(-delta) / (2*a); printf("x1 = %f + %fi, x2 = %f - %fi\n", real, imag, real, imag); } } printf("Enter a, b, c:\n"); } system("pause")

实验三

╄→尐↘猪︶ㄣ 提交于 2019-12-04 15:53:52
// 一元二次方程求解 // 重复执行, 直到按Ctrl+D或Ctrl+E结束 // #include <math.h> #include <stdio.h> #include <stdlib.h> int main() { float a, b, c, x1, x2; float delta, real, imag; printf("Enter a, b, c: "); while(scanf("%f%f%f", &a, &b, &c)) { if(a == 0) printf("not quadratic equation.\n"); else { delta = b*b - 4*a*c; if(delta >= 0) { x1 = (-b + sqrt(delta)) / (2*a); x2 = (-b - sqrt(delta)) / (2*a); printf("x1 = %f, x2 = %f\n", x1, x2); } else { real = -b/(2*a); imag = sqrt(-delta) / (2*a); printf("x1 = %f + %fi, x2 = %f - %fi\n", real, imag, real, imag); } } printf("Enter a, b, c:\n"); } system("pause"); return