Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

1 foot = 0.3048 meters

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Security

Authors: Alfred Basta, Melissa Zgola

1st Edition

1435453905, 978-1435453906

More Books

Students also viewed these Databases questions

Question

Define intercultural conflict

Answered: 1 week ago