Reading in .txt file to 2D array

Hello. My assignment is to read in from a .txt file two things: an integer and a string. After reading in these 2 items I have to put them into a 10x10 2D array so that both the number and the character can be manipulated by the user. Here are the contents of the text file:

Dr. J's Garden
0.21,B, 2.80,G, 4.96,B, 2.66,B, 4.48,B, 0.61,T, 0.40,B, 3.50,G, 3.63,B, 3.91,T,
2.33,T, 4.51,G, 1.15,G, 4.95,T, 2.76,T, 4.51,T, 2.54,G, 4.04,T, 2.38,B, 0.62,B,
4.54,G, 3.38,T, 1.57,T, 3.92,T, 3.03,B, 4.72,G, 0.23,B, 4.02,G, 4.69,G, 0.66,G,
1.34,T, 2.21,G, 2.48,G, 4.85,T, 3.25,G, 3.55,G, 4.78,B, 0.81,G, 0.74,G, 2.55,G,
3.35,G, 4.52,G, 4.81,G, 2.67,G, 4.97,B, 0.87,G, 1.28,G, 4.58,B, 1.91,B, 3.69,B,
3.02,T, 3.15,T, 1.08,T, 4.68,G, 1.10,B, 3.17,G, 1.97,T, 0.99,G, 4.50,T, 3.87,T,
3.36,G, 1.60,T, 3.73,G, 2.14,B, 3.68,B, 2.44,G, 3.10,G, 4.54,B, 0.25,B, 0.25,G,
1.79,B, 3.02,G, 2.21,T, 0.22,G, 3.67,B, 4.46,G, 2.14,G, 2.31,G, 0.80,T, 3.83,B,
1.56,B, 1.41,T, 0.80,G, 1.27,T, 0.08,B, 1.20,G, 2.88,B, 2.78,T, 3.30,B, 1.75,B,
2.60,G, 4.72,T, 4.55,T, 0.89,B, 0.52,B, 2.06,T, 0.28,G, 4.36,T, 4.41,G, 0.36,B,

One number and one character need to be assigned to each element of the array. I know exactly how to fill a 2D array when it's just numbers, but the characters and the commas are giving me a lot of trouble. Any tips on how I can do this?
you can use std::pair<double, char> to store both interrelated values. (BTW, you have floating point values, not integers.) Commas are just delimeters, skip them.
Topic archived. No new replies allowed.