speed.cpp

来自「Computing for Speed in C」· C++ 代码 · 共 78 行

CPP
78
字号
/* Speedometer - Project

   By: Debhy Bacamante
       Cestonie Tampus
*/

#include <stdio.h>
#include <conio.h>

void speedometer();

void main()
{
  clrscr();

		speedometer();
  getch();

}
void speedometer()
//{
//	int cHour, Speed;


       //	printf("This Program will track the speed the car in\na series of time\n");

//getch();
//}

//int speedometer()
{

	float cHour, a1,a2,a3,a4, a5, t;
	float Vi, Vf, Vf1, Vf2;
	float x;
	int i;
//clrscr();

	//Vi = 15.0;

	printf("Please Input you Distance \n");
	printf("Distance : ");
	scanf("%f", &x);
	printf("\n\n");
	printf("Table: \n\n");
	printf("  Time       Speed(mph)\n");
	printf("__________________________\n\n");
    //	a3=x;

	for(i=40;i!=70+1;i++)
	{
	    t=i/60.0/60.0;
	    Vi=15.0;

	  a1=Vi*t;
	  a2=t;
	 // a3=t/2.0;
	  a3=a2*a2;
	  a4=a1 + a3;
	  a5=a4/x;
	 // a6=a1+a3;

	  Vf1=Vi;
	  Vf2=a5*t;
	  Vf=Vf1+Vf2;

	  printf("   %ds  -  %.10f mph\n", i, Vf);

	}
//getch();
}






⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?