c++ code for beginner for converting feet to meter

nirveshverma -1 Tallied Votes 6K Views Share

hi enjoy it and give feedback

#include <iostream>

using namespace std;

int main()
{
    double f;
    double m;
    
    cout<< " enter Length in Feet";
    cin>>f;
    
    m = f/3.28;  // Convert To Meters
    cout << f << "feet is" << endl << m << "Meter's" << endl;
    
    
    system("pause");
    return 0;
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
Foamgum 0 Newbie Poster

You can improve your code by using an exact conversion instead of the approximate one that you have used.

m = f/3.28;   // This is an approximate conversion.
m = f*0.3048;    // This is an exact conversion.
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.