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;
}

}

Recommended Answers

All 6 Replies

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.