using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;//pt fisiere
namespace sort2
{
class Program
{
static void Main(string[] args)
{
int n=0;
int[] A = new int[101];
StreamReader fin = new StreamReader("sort2.in");//deschide fisierul de citire
StreamWriter fout=new StreamWriter("sort2.out");//deschide fisierul de iesire
while (!fin.EndOfStream)//parcurg pana la finalul fisierului
{
string l = fin.ReadLine();//citesc o linie in l
string[] s = l.Split();//despart l in s
foreach (string ss in s)//parcurg s
if(ss!="")
{
int x = int.Parse(ss);//trasnsfor ss in numarul x
if (x <= 99)
A[++n] = x;
}
}
if(n==0) fout.WriteLine("NU EXISTA");
for(int i=1;i<n;i++)
for(int j=i+1;j<=n;j++)
if(A[i]>A[j])
{
int aux=A[i];
A[i]=A[j];
A[j]=aux;
}
for(int i=1;i<=n;i++)
fout.Write(A[i]+" ");
fin.Close();
fout.Close();
}
}
}
|