How to arrange the number properly?

/*-------------------
Two dimensional array
-------------------*/

#include<iostream.h>
#include<fstream.h>
#include<iomanip.h>

ifstream infile("STA83EXM.txt");

void main()
{
const int row = 140;
const int column = 140;
int matrix[row] [column];

//**************creates Matrix****************
int num;
for(int i = 0; i<=row-1; i++)
{
for(int j = 0; j<=column-1; j++)
{
infile>>num;
matrix[i][j]=num;
}
}

//***************Prints out Matrix*********************

{	cout << "i,j"<<"\t";
for(int i = 1; i < 140; i++)
{
cout<<i<<"\t";
}

for(int j= 1; j < 140; j++)
{
cout<<j<< "\n";
}
return;
}

}
3
Contributors
6
Replies
7
Views
9 Years
Discussion Span
Last Post by WaltP

How to arrange the number properly?

One digit after another. If there is a portion that's below 1, add a '.' and that portion. If negative, '-' in front of all the digits.

I dont understand...what mean by below 1?

0.24, 0.5, 0.997

the number is 1 until 139

no number below 1 and negative.

How to arrange the number properly?

Congrats: Taking this and other threads into account, you've just scored an A+ in "The art of asking vague questions"!

Perhaps you mean sorting a list a numbers? If so:bubblesort

Edited by Nick Evan: n/a

the number is 1 until 139

no number below 1 and negative.

OK, then I update my quote with this new information:

One digit after another.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.