Chinaunix首页 | 论坛 | 博客
  • 博客访问: 592126
  • 博文数量: 149
  • 博客积分: 7191
  • 博客等级: 少将
  • 技术积分: 1561
  • 用 户 组: 普通用户
  • 注册时间: 2005-12-19 14:15
文章分类

全部博文(149)

文章存档

2013年(1)

2011年(2)

2010年(14)

2009年(29)

2008年(26)

2007年(31)

2006年(32)

2005年(14)

分类: C/C++

2007-11-12 21:28:06

/* 此程序针对上海交通大学 气垫导轨上碰撞瞬间的测量 实验编写.
* 这是我写的一个新版本,与上一个版本相比,这个只要把数据文件拖曳到编译好的软件上就可以了。
* This program is  compiled by G++ in Linux.
* This program is written by 张浩.
* The result will be output into the txt file "result.txt".
* StudentID: 5050309640
* ClassID: F0503023
* Date: 2007-11-12
*/
#include
#include
#include
using namespace std;
int main(int argc, char* argv[])
{
 ofstream out("result.txt");
 ifstream in(argv[1]);
 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;
}
阅读(1252) | 评论(0) | 转发(0) |
0

上一篇:SmithFlash通知

下一篇:终于做完科创5了

给主人留下些什么吧!~~