#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

#### Categories

Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

# Simple C++ program to convert inches and feet to centimeters

Posts: 2Member
Hey guys, I am very new to c++, and im trying to learn and create basics codes.

Could you guys please tell me what i am doing wrong here.

I want to maintain my current coding format.

Thanks

#include
#include
#include

using namespace std;

int main()
{
const double feet_to_inch = 12; // conversion from feet to inches
const double inch_to_centi = 2.54; // conversion from inches to centimenters

int feet ; 0
double inches ; = 0.0, total_inches = 0.0 ;
double centimeters ; 0.0

// Conversion Program to centimeters
cout << "hello world";

// Entered value by user in feet
cout << "
Enter in feet" ;
cin >> feet ;

// Entered value by user in inches
cout << "
Enter in inches" ;
cin >> inches ;

//Calculate number of inches
total_inches = inches + feet * feet_to_inch ;

// Convert to centimeters
centimeters = total_inches * inch_to_centi ;

// Output results
cout << "/n The Result is :" << centimeters;

char c;
cout << "/n Press anything to Exit" ;
cin >> c;

return 0;

}[hr]

· ·

• Posts: 1Member
I'm obv very late, and you probably don't even need this anymore. But here...

[code]
#include
#include
#include

using namespace std;

int main()
{
const double feet_to_inch = 12; // conversion from feet to inches
const double inch_to_centi = 2.54; // conversion from inches to centi

int feet = 0;
double total_inches = 0.0;
double total_centi = 0.0;

// Conversion Program to centimeters
cout << "hello world";

// Entered value by user in feet
cout << "
Enter in feet" ;
cin >> feet ;

// Entered value by user in inches
cout << "
Enter in inches" ;
cin >> inches ;

//Calculate number of inches
total_inches = feet * feet_to_inch ;

// Convert to centimeters
total_centi = total_inches * inch_to_centi ;

// Output results
cout << "/n The Result is :" << total_centi;

char c;
cout << "/n Press anything to Exit" ;
cin >> c;

return 0;

}[/code]
· ·