# Thread: problem with metric to english conversion

1. ## problem with metric to english conversion

I am a c student and can't seem to figure out this Metric conversion program. It reads. Write a program that will assist the user with metric conversions. Your program should allow the user to specify the names of the units as a string(ie meters, liters, kilograms for metric and inches, quarts, pounds, feet for english) and should respond to simple questions such as
"How many inches are in 2 meters?"
"How many liters are in 10 quarts?"

and it should recognize invalid conversions such as

"How many feet ar in 5 kilograms?'

Any help would be greatly appreciated!!!!!!!!

2. The first answer you're likely to get is "Post some code", so post some code.

I find it easier to work on code if I write myself a little framework first. I break it down into components, such as input, processing and output. Then I break down each of those parts like - Input .. prompt user, read info, break down input to useable chunks. Once I've done that I write code. If you grab a pen and paper it would take you about two minutes to write a framework. It will help you keep focussed, and once you have an attempt, even if it doesn't work well or at all, people here will be very helpful.

3. I guess I am not advanced enough to use this board.

4. I hope I didn't over complicate things or give you the wrong impression in my post. It's just that this really is a help board, not a "do for you" board. If you make a start people will help. If you're a C student this doesn't look like an assignment that would be given with no grounding in the concepts required, I would imagine you'd be able to write some of the code, once you've written something post it in this thread, remember to use code tags, help will be forthcoming.

5. Big hint
Code:
```#include <stdio.h>

int main ( void ) {
char buff[BUFSIZ];
char from[BUFSIZ],to[BUFSIZ];
int  howmany;
while ( fgets( buff, BUFSIZ, stdin ) != NULL ) {
if ( sscanf( buff, "How many %s are in %d %s", from, &howmany, to ) == 3 ) {
printf( "converting %d from %s to %s\n", howmany, from, to );
} else {
printf( "I don't understand\n" );
}
}
return 0;
}```