how to convert a string value to float or double?

i use atoi function but giving me integer value

sample code:

Code:
int main()
{

string a = "5.1234";
float b;

b = atoi(a.c_str());
cout<<b;

return 0;
}
sample output:
5

but i want to get is 5.1234
got any solution?