converting feet to meter
Mar 25, 2011 at 2:28pm
I'm writing a program that allows the user to input a string of numbers then convert it in to a double then converts the numbers to feet
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
#include <iostream>
#include <cstring>
#include <cstdlib>
using namespace std;
int main()
{
string input;
float feet[10], meter;
cin >> input;
for(int a = 0; a < 3; a++)
{
feet[a] = atof(input);
meter = feet[a] * 0.3048;
cout << feet[a] << " feet is " << meter << " meters" << endl;
}
return 0;
}
|
Mar 25, 2011 at 3:05pm
Why are you using an array for "feet"?
Mar 25, 2011 at 8:54pm
You would probably get more help if you asked a specific question.
Mar 26, 2011 at 8:00pm
Why don't you read a float by cin?
regards
Topic archived. No new replies allowed.