Technicalsymposium.com-Free Email Alerts


Enter Your Email :

Important Note:Login & Check Your Email Inbox and Activate Confirmation Link

Subscribe & Get All Fresher Jobs Information & Study Materials PDF and Projects- Free Download

C++ Programming


C++ Programming Jobs


C++ Programming Books



C++ Programming Projects PDF- Free Download

C++ Program for to read the content of the file sort.

#include<iostream.h>
#include<fstream.h>
#include<conio.h>
#include<string.h>
void main()
{
clrscr();
char c[25],str[20][20],d[20];
int j,count;
j=count=0;
ifstream ifs("d:\\first1.txt");
ofstream sort("d:\sort.txt");
cout<<"\n\n\t\tFILE CONTENT BEFORE SORTING\n\n";
while(!ifs.eof())
{
ifs.getline(c,20);//READING FROM THE FILE
strcpy(str[count],c);
cout<<c<<endl;
if(count)
{
/*sorting*/
strcpy(str[count],c);
for(j=0;j<=count;j++)
{
if(strcmpi(str[count],str[j])<0)
{
strcpy(d,str[j]);
strcpy(str[j],str[count]);
strcpy(str[count],d);
}
}
}
count++;
}
cout<<"\n\nFILE CONTENT AFTER SORTING";
for(j=0;j<count;j++)
{
sort<<str[j]<<endl;//writing
cout<<"\n"<<str[j];
}
getch();
}

Download All C++ Study Materials & ebook PDF


C++ Programming