can anybody give me an idea how to sort string in alphabetical order in file.text after user input string and in the file already had a list of string?
which is the best,let user input the all string first then sorting it or sorting if after user input the string?

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

void main()
{

	fstream kamus("Adkjektif.txt",ios::in | ios::out | ios::app);
   const size = 30;
   char kata2[size];
   cout<<"input string (end for stop)"<<endl;
   for(;;)
   {

   	cin.getline(kata2,size);
   	if (strcmpi(kata2,"end")==0)
   		break;
         else
   	 kamus<<kata2<<endl;

   }
	kamus.close();
}

this is the content of the file

small
tall
big

there are methods of sorting text files, but they are generally pretty complicated. If the file is small enough, just read all the strings into an in-memory array, sort the array, then rewrite them back to the file. If you are writing c++ program that is pretty easy -- read the strings into a std::vector<std::string> array, then use std::sort() to sort it.

Use a pretty recent compiler such as Dev-C++. The code you posted uses iostream.h which has been obsolete for several years, so I suspect you are using a pretty ancient compiler such as Turbo C++.