converting feet to meter

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;
}
Why are you using an array for "feet"?
You would probably get more help if you asked a specific question.
Why don't you read a float by cin?

regards
Topic archived. No new replies allowed.