/* 此程序针对上海交通大学 气垫导轨上碰撞瞬间的测量 实验编写.
* 水平一般,见笑了!
* This program is compiled by Visual C++6.0
* This program is written by 张浩.
* The result will be output into the txt file "result.txt".
* StudentID: 5050309640
* ClassID: F0503023
* Date: 2006-10-26
*/
#include
#include
#include
using namespace std;
int main()
{
ofstream out("result.txt");
ifstream in("data.txt");
string strtemp="";
for(int i=0;i<8;i++)
in>>strtemp;
long sum=0, low=1000;
double result=0;
int temp=0;
while(in>>temp)
{
sum+=temp;
low=low>temp?temp:low;
}
result=double(1000*(sum-low*1000)/256)/1000000;
//------------------------------------------------------
double quality, length=0.0100, t1, t2, result1,error;
cout<<"请输入滑块质量,单位Kg:"< cin>>quality;
cout<<"请输入两次通过的时间间隔t1&t2,单位ms,用空格隔开:"< cin>>t1>>t2;
result1=quality*length*(1000/t1+1000/t2);
error=100*(result-result1)/result;
out<<"**********************************************"< out< out< out< cout<<"The result has been output into the result.txt"< return 0;
}
阅读(1876) | 评论(1) | 转发(0) |