sorting an array cleanly

I'm writing a program that takes in numbers from a file, places them into an array then sorts the array. My question is how to make the program cout the numbers alone without the commas.

#include <iostream>
#include <fstream>
using namespace std;

const int SIZE = 99;
void sort(char array[], int n);

int main()
{

char file[25];
char * array = new char[SIZE];
int number = 0;
double x[SIZE];

cout << "Enter FIle\n";
cin >> file;

ifstream fin(file);

while(!fin.eof() && number<SIZE)
{
fin.get(array[number]);
number++;
}
cout << "Unsorted Array\n";

for(int i = 0; i<SIZE; i++)
{
cout << array[i];
}
cout << " \n";

cout<<" Sorted Array\n";

cout <<" \n";

sort(array,SIZE);

for(int k=0;k<SIZE;k++)
{
cout << array[k] << " ";
}
cout << "\n";


return 0;
}

void sort (char array[], int n)
{
int m;
double hold;

for(int k=0; k<= n-2; k++)
{
m = k;
for(int j=k+1;j<=n-1;j++)
{
if(array[j]<array[m])
m=j;
}

hold = array[m];
array[m] = array[k];
array[k] = hold;
}

}
Use a loop to check if the input is a number or not before printing or storing into the array

http://www.cplusplus.com/reference/cctype/isdigit/
Topic archived. No new replies allowed.