using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace Sort_file_handling
{
class Program
{
static int c = 0;
static void Main(string[] args)
{
string path = "file.txt";
StreamReader sw = new StreamReader(path);
string sorting = "";
string s = "";
string[] ss = null;
while ((sorting = sw.ReadLine()) != null)
{
ss = sorting.Split(' ');
foreach (var item in ss)
{
s += " " + item;
}
}
int count = 0;
string[] s2 = s.Split(' ');
Array.Sort(s2);
foreach (var item in s2)
{
++count;
}
Console.WriteLine("Total no of word in list is " + count);
Console.WriteLine("Alphatical liting of word is :");
foreach (var item in s2)
{
++count;
Console.WriteLine(item);
}
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace Sort_file_handling
{
class Program
{
static int c = 0;
static void Main(string[] args)
{
string path = "file.txt";
StreamReader sw = new StreamReader(path);
string sorting = "";
string s = "";
string[] ss = null;
while ((sorting = sw.ReadLine()) != null)
{
ss = sorting.Split(' ');
foreach (var item in ss)
{
s += " " + item;
}
}
int count = 0;
string[] s2 = s.Split(' ');
Array.Sort(s2);
foreach (var item in s2)
{
++count;
}
Console.WriteLine("Total no of word in list is " + count);
Console.WriteLine("Alphatical liting of word is :");
foreach (var item in s2)
{
++count;
Console.WriteLine(item);
}
}
}
}
0 comments:
Post a Comment