Question: Using c++ Write a program to convert feet to meters. The conversion from feet to meters is: 1 foot = 0.3048 meters The input will
Using c++
Write a program to convert feet to meters. The conversion from feet to meters is:
The input will be numbers passed on the command line. You will want to use the library function atof() to convert a string into a float. For example, consider the following code:
#include // the library for atof() #include // the library for atof() using namespace std; int main() { char text[] = "3.14159"; // a c-string float pi; // the float where the answer will go pi = atof(text); // atof() translates the c-string into a float cout << pi << endl; // this better be 3.14159 return 0; } Pay special attention to the #include code. You will need that for this assignment!
Example
Consider the output of a program called a.out:
a.out 1 2 3 1.0 feet is 0.3 meters 2.0 feet is 0.6 meters 3.0 feet is 0.9 meters
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
