///* 2022.4.18 */
///* running.c -- A useful program for runners */
//#include <stdio.h>
//const int S_PER_M = 60; /* 1分钟的秒数 */
//const int S_PER_H = 3600; /* 1小时的秒数 */
//const double M_PER_K = 0.62137; /* 1公里的英里数 */
//
//int main();
//{
// double distk, distm; /* 跑过的距离(分别以公里和英里为单位)*/
// double rate; /* 平均速度 (以英里/小时为单位)*/
// int min, sec; /* 跑步用时 (以分钟和秒为单位)*/
// double mtime; /* 跑一英里需要的时间 以秒为单位 */
//
// printf("This program converts your time for a metric race\n");
// printf("to a time for running a mile and to your average\n");
// printf("speed in miles per hour.\n");
// printf("Please enter,in kilometers, the distance run,\n");
// scanf("%lf", &distk); /* %lf 表示读取一个double 类型的值*/
// printf("Next enter the time in minutes and seconds.\n");
// printf("Begin by entering the minutes.\n");
// scanf("%d", &min);
// printf("Now enter the seconds.\n");
// scanf("%d", &sec);
//
//
//
// time = S_PER_M * min + sec; /* 把时间转换成秒 */
// distm = M_PER_K * distk; /* 把公里转换成英里 */
// rate = distm / time * S_PER_H; /* 英里 / 秒 X 秒/ 小时 = 英里 / 小时 */
// mtime = (double)time / distm; /* 时间 / 距离 = 跑一英里所用的时间 */
// mmin = (int)mtime / S_PER_M; /* 求出分钟数 */
// msec = (int)mtine % S_PER_M; /* 求出剩余的秒数 */
//
// printf("You ran %1.2f km (%1.2f miles) in %d min, %d sec.\n",distk,distm,min,sec);
// printf("That pace corresponds to running a mile in %d min, ", mmin);
// printf("%d sec.\nyour average speed was %1.2f mph.\n", msec, rate);
//
// return 0;
//}
///* 2022.4.18 */
///* running.c -- A useful program for runners */
//#include <stdio.h>
//const int S_PER_M = 60; /* 1分钟的秒数 */
//const int S_PER_H = 3600; /* 1小时的秒数 */
//const double M_PER_K = 0.62137; /* 1公里的英里数 */
//int main()
//{
// double distk, distm;
// double rate;
// int min, sec;
// int time;
// double mtime;
// int mmin, msec;
//
// printf("This program converts your time for a metric race\n");
// printf("to a time for running a mile and to your average\n");
// printf("speed in miles per hour .\n");
// printf("%1f", &distk);
// scanf("%lf", &distk);
// printf("Next enter the time in minutes and seconds.\n");
// printf("Beg by entering the minutes.\n");
// scanf("%d", &min);
// printf("Now enter the time in minutes and seconds.\n");
// printf("Beg by entering the minutes.\n");
// scanf("%d", &min);
// printf("Now enter the seconds.\n");
// scanf("%d", &sec);
//
// time = S_PER_M * min + sec; /* 把时间转换成秒 */
// distm = M_PER_K * distk; /* 把公里转换成英里 */
// rate = distm / time * S_PER_H; /* 英里/秒X秒/小时 = 英里/小时 */
// mtime = (double)time / distm; /* 时间/ 距离 = 跑1英里所用的时间 */
// mmin = (int)mtime / S_PER_H; /* 求出分钟数 */
// msec = (int)mtime % S_PER_M; /* 求出剩余的秒数 */
//
// printf("You ran %1.2f km (%1.2f miles) in %d min,%d sec.\n", distk, distm, min, sec);
// printf("That pace corresponds to running a mile in %d min");
// printf("%d sec.\nYour average speed was %1.2f mph.\n", msec, rate);
//
// return 0;
//}
This program converts your time for a metric race
to a time for running a mileand to your average
speed in miles per hour .
0.000000
这个程序转换您的时间为公制赛跑
达到跑一英里的时间和你的平均水平
速度(英里 / 小时)。
0.000000
///* summing.c -- 根据用户键入的整数求和 */
//#include <stdio.h>
//int main()
//{
// long num;
// long sum = 0l; /* 把sum 初始化为0 */
// int status;
//
// printf("Please enter an integer to be summed ");
// printf("(q to quit ): ");
// status = scanf("%ld", &num);
// while (status == 1) /* == 的意思是等于 */
// {
// sum = sum + num;
// printf("Please enxt next integer (q to quit): ");
// status = scanf("%ld", &num);
// }
// printf("Those integers sum to %ld.\n", sum);
//
// return 0;
//}
Please enxt next integer(q to quit) : 8
Please enxt next integer(q to quit) : 33
Please enxt next integer(q to quit) : 33
Please enxt next integer(q to quit) :
请输入一个要求和的整数(q要退出) : 44
请输入下一个整数(q to quit) : 8
请输入下一个整数(q to quit) : 33
请输入下一个整数(q to quit) : 33
请输入下一个整数(q退出) :