I did a program to count the word frequencies. Then i applied it on AlQuran. Finally, i found a miracle...
I will leave you with:
//Author: Ahmed Sayed
//This powerful program gets the frequencies of the distinct words which ALLAH used in the Quran
#include <iostream>
#include <fstream>
#include <string>
#include <map>
using namespace std;
const int N = 20000;
string word[N];
int k = 0;
//
bool found (string S)
{
for (int i=0; i<k; i++)
if ( word[i] == S)
return true;
return false; };
//sorting the array alphabetically
void sort(){
string temp;
while (k!=0)
{
for (int i=0; i<k; i++)
if (word[i] > word[i+1])
{temp = word[i];
word[i] = word[i+1];
word[i+1] = temp;}
k--;
}
};
//1
int main ()
{
map<string, int> wordcounts;
string s;
ifstream source; source.open("AlQuran.txt");
ofstream target; target.open("words.txt");
while (source >> s)
{++wordcounts[s];
if (! found (s))
{word[k] = s;
k++;}
}
target << "بسم الله الرحمن الرحيم .... اللهم بارك في السيد احمد سيد عطيه" << endl;
target << " عدد الكلمات او الالفاظ ذات التشكيل المختلف في القران" << ": " << k << endl << endl;
target << "هنا عدد استخدام كل كلمة من قبل الله -سبحانه و تعالي " << endl;
//sort(); don't sort
// first appeared first written
//First come first served
for (int j=0; j<wordcounts.size(); j++)
target << word[j] << ' ' << wordcounts[word[j]] << endl;
system ("pause");
return 0;
}