File into arrays

I want to read a file into three arrays , the file looks like this :
Bar soap
1000 0.27
Laundry Detergent
200 5.15
as you can see the first line must read into array of type string. The second array of type integer should read the first number in the second line, The last array should be type float and read the last part. How can I do that in c++. Thanks for sharing the knowledge.
This is how I would do it:
1
2
3
4
5
6
7
8
9
10
11
12
13
#include <string>
#include <iostream>

int main() {
	std::string a1[3];
	int a2[3]={0};
	float a3[3]={0};
	for(int i=0; i<2; ++i) {
		getline(std::cin, a1[i]);
		std::cin>>a2[i]>>a3[i];
		std::cin.ignore(256, '\n');
	}
}
Thank you. Can you just explain to me how this code jump from one line to another , and from the first piece in the second line to the second piece in the same line?
jump from one line to another

please elaborate.

first piece in the second line to the second piece in the same line

Which line do you consider the "second" line. Please refer to the line number next to the code block surrounding the code.
O,k thanks for being there. Suppose I have this
soap // the first line in the file (goes to string )
200 2.0 // the second line in the file goes to integer array and float.
Topic archived. No new replies allowed.