0

I want the program to take user input to fill a 2D array of ints and I'm not sure what the easiest format to have the user enter the data would be (easy in terms of programming).

For example in Java I could use .split() to separate integers by spaces or commas etc., but since a string can't easily be broken up in C++, this is a problem.

I don't want to prompt the user each time for each element such as:

enter integer for location 0, 0
enter integer for location 0,10
enter integer for location 2, 0
Celeritas
  • 14,489
  • 36
  • 113
  • 194

1 Answers1

1

Here is a stackoverflow answer that talks about how to tokenize a string in C++

How do I tokenize a string in C++?

I haven't tried boost but strtok is pretty easy to use but may have some multithreading issues.

Community
  • 1
  • 1
srs
  • 516
  • 1
  • 4
  • 20