Hi, I'm totally new to C++ and so far am extremely confused. I was wondering if anyone could give me any help with one of my assignments. Basically I don't know where to even start. I think if maybe someone can help me get started maybe I can figure this problem out. Anyways, here's the problem...

Write a program that prompts the user to input a length expressed in centimeters. The program should then convert the length to inches and output the length expressed in yards, feet, and inches, in that order. For example suppose the input for centimeters is 312. To the nearest inch, 312 centimeters is equal to 123 inches. 123 inches would thus be output as:
3 yards, 1 foot, and 3 inches.

Any help would be greatly appreciated.

Well we dont do homework but here is a basic idea of how you would go about this. first you would need to ask the user to input the length in centimeters using cin. and then you take the info you get and you would then have the program convert centimeters to inches. and from inches its not hard to figure out how many yards, feet and inches that equals :) try to post atleast alittle bit of code next time thanks :)

Thanks for the help...Have I started this off right so far?

#include <iostream.h>


using namespace std;


const double conversion = 2.54
const int inchesPerFoot = 12


int main()
{
int centimeters, inches;
int yards, feet;


cout << "Enter length in centimeters: ";
cin >> centimeters;
cout << endl;
cout << "The number entered was " << centimeters
<< " for centimeters. " << endl;



return 0;
}

You need to terminate the following statements with semicolons:

const double conversion = 2.54;
const int inchesPerFoot = 12;

And this was okay many years ago...

#include <iostream.h>

...but if you are living in the 21st century, it should be...

#include <iostream>

...especially since you are...

using namespace std;

Just a hint, after doing Dave's corrections study up on the modulus operator % ...

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.