cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Help.
Help.
Mar 20, 2013 at 11:41pm UTC
lauarius
(2)
How to enter a number for "t"
//Test 1 Part 2 Lavarius Williams 3/20/13
#include "stdafx.h"
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main()
{
double t, v, a;
cout<<"Enter time in sec : \n";
cin>>t;
v=0.00001*pow(t,3)-0.00488*pow(t,2)+0.75795*t+181.3565;
a=3-0.000062*pow(v,2);
cout<<fixed<<setprecision(3);
cout<<"v="<<setw(10)<<v<<"m/s"<<endl;
cout<<"a="<<setw(14)<<a<<"m/s^2"<<endl;
return 0;
}
Mar 21, 2013 at 11:28pm UTC
tcs
(519)
After launching your application the process blocks until you've entered any floating point number. F.e.
3.1415
. You've to terminate the input by pressing CR-key on your keyboard.
Does this answer your question?
Topic archived. No new replies allowed.