编程笔记

  • 对具有指数数的表达式的求值

    #include<stdio.h> int main (void){ float result; result = (3.31e-8 * 2.01e-7) / (7.16e-6 * 2.01e-8); printf("result = %e/n", result); return 0; }

    编程笔记 2022年6月7日
  • 从华氏温度转换为摄氏温度

    #include<stdio.h> int main (void) { float c; float f = 127.0; c = (f - 32) / 1.8; printf("%f degrees Fahrenheit equals %f Celsius /n", f, c); return 0; }

    编程笔记 2022年6月7日
  • 读取成绩,计算平均考试成绩

    #include <stdio.h> int main() { int numTest; float stTest, avg, total = 0.0; for (numTest = 0; numTest < 25; numTest++) { printf("/nWhat is the next student's test score? "); s…

    编程笔记 2022年6月7日
  • 输入值乘法

    #include <stdio.h> #include <stdlib.h> int main() { float height_in_cm; char height_in_inches[4]; printf("Enter your height in inches:"); gets_s(height_in_inches); height_in_cm …

    编程笔记 2022年6月7日
  • 使用数学来增加体重值

    #include <stdio.h> #include <stdlib.h> int main() { char weight[4]; int w; printf("Enter your weight:"); gets_s(weight); w=atoi(weight); printf("Here is what you weigh now:…

    编程笔记 2022年6月7日
  • 从用户读取值,计算花费总金额

    #include <stdio.h> #include <stdlib.h> int main() { int houses, hotels, total; char temp[4]; printf("Enter the number of houses:"); gets_s(temp); houses=atoi(temp); printf(&quot…

    编程笔记 2022年6月7日
  • 计算季度的总收入并输出

    #include <stdio.h> int main(void) { const float Revenue_Per_150 = 4.5f; unsigned int PC =11111110; // Stock sold in January unsigned int Memory =22222220; // Stock sold in February unsigned int…

    编程笔记 2022年6月7日
  • 使用浮点数

    浮点数保存带小数点的值。以下代码是浮点值的示例: #include <stdio.h> int main(void) { float f = 1.5; printf("%f/n",f); f = 0.00008; printf("%f/n",f); f = 100.0; printf("…

    编程笔记 2022年6月7日
  • 用指数格式表示浮点数

    可以写在指数格式浮点数的值。 值 使用指数 使用C语写成 1.6 0.16 x 10^1 0.16E1 0.00008 0.8 x 10^-4 0.8E-4 1234.899 0.1234899 x 10^4 0.1234899E4 100.0 1.0 x 10^2 1.0E2 将float写在程序中。 #include <st…

    编程笔记 2022年6月7日
  • 浮点变量类型仅存储浮点数

    浮点变量类型仅存储浮点数。 关键字 字节数 值范围 float 4 +/- 3.4E +/- 38(精确到6到7位小数) double 8 +/- 1.7E +/- 308(15位小数精度) long double 12 +/- 1.19E +/- 4932(18位小数精度) #include <stdio.h&…

    编程笔记 2022年6月7日