title: How to format an array and output?
body: <p>Ok need some help. I have read in a file to an array. I need to take the array and format it so that the numbers are formatted. The text file is just a list of numbers. For example, I need to take the first two numbers and format them so that it is printed out to the console like this: "1-0". Here is my code so far. Notice the incomplete function where the formatting should take place.</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include&lt;cmath&gt;
  #include&lt;cstdlib&gt;
  #include&lt;string&gt;
  #include&lt;fstream&gt;
  
  using namespace std;
  
  string ArrayFormat(int array[]);
  
  int main() {
  
  const int ARRAY_SIZE = 21;
  string filename;
  ifstream inputfile;
  
  int score[ARRAY_SIZE];
  
  
  cout &lt;&lt;"\nPlease enter the name of a file: ";
  cin &gt;&gt; filename;
  
  inputfile.open(filename.c_str());
  if (inputfile.fail()){
      perror(filename.c_str());
      exit(1);
  }// end of error test
  
  for (int i=0;i&lt;20;i++){
      inputfile &gt;&gt; score[i];
     // cout &lt;&lt; score[i] &lt;&lt; endl;
  }// end of for loop to read into array
  inputfile.close();
  
  
  }// end of main
  
  
  string ArrayFormat(int array[]){
  
  
  for(int i=0; i&lt;=21; i++){
  
  }
  
  
  }// end of ArrayFormat
  </code></pre>