// this program is to sort words from a file ascending or descending by bubble sorting algorithm
//0
#include <iostream>
#include <string>
#include <fstream>
//1
using namespace std;
//2
int main ()
{
// declare
string a[21000]; // define huge array
string s = "";
int k, z = 0;
// import all the words in an array
ifstream word;
word.open("words.txt");
while (! word.eof())
{
word >> a[z]; // insert new word; do z++
z++;
};
// sort the array using bubble sorting algorithm
for (int i = 0; i < z; i++)
{
for ( k = 1; k < (z - i); k++) // each word we do n-itsPosition comparisons
{
if (a[i+k] < a[i]) // for ascending use <; for descending use >
{
s = a[i];
a[i] = a[i+k];
a[i+k] = s;
}
}
}
// print out the sorted words
for (int j = 0; j < z; j++) // z is number of lines in file
cout << a[j] << endl;
// pause
system("PAUSE");
return 0;
}
12 May 2009
09 May 2009
(سورة البقرة) بصوت الشيخ عبد الباسط عبد الصمد
YouTube:
http://www.youtube.com/watch?v=QqMPV63DnBE
Sent from my iPod
08 May 2009
www.flickr.com
http://www.customsigngenerator.com/ graphics with and on images
http://openphoto.net/ pictures
What can you do with the new Windows Live? Find out
http://openphoto.net/ pictures
What can you do with the new Windows Live? Find out
First Picture
http://www.mailonpix.com/images/b93ed831e8eee3c6fb2b95bcecc67458.gif
What can you do with the new Windows Live? Find out
What can you do with the new Windows Live? Find out
07 May 2009
To Divid The Huge File.cpp
If we tried to open a 2.3 Gigabyte text file, error message will apear telling you "Notpad can't open the file because it is very huge, try to use a different text editor".
Thus, we will do a program to divid the huge file into 30 parts nearly each of size 76 megabyte nearly and each has 10,000,000 words nearly.
so 10,000,000*30=300,000,000 words. 76*30=2280 megabyte=2.3gigabyte nearly.
-------------------------------------------------------------------------------
// program to divid the whole 2.3 gigabyte file to 36 parts
//0
#include <iostream>
#include <fstream>
#include <string>
//1
using namespace std;
//2
int main ()
{
// reading IN file
ifstream IN;
IN.open("IN.txt");
// defintions
char no[] = {'a', 'b', 'c', 'd', 'e'};
char no1[] = { '1', '2', '3', '4', '5', '6'};
string name1 = "Part";
string name;
while (! IN.eof() )
{
// names of the output files
for (int i=0; i < 5; i++)
for (int j=0; j< 6; j++)
{
name = name1 + ' ' + no[i] + '_' + no1[j] + ".txt";
string s;
IN >> s;
// ofstream OUT;
ofstream OUT;
OUT.open(name.c_str());
for ( int l=1; l<=10000000; l++)
{OUT << s << endl;
IN >> s;}
}
}
system("pause");
return 0;
}
Thus, we will do a program to divid the huge file into 30 parts nearly each of size 76 megabyte nearly and each has 10,000,000 words nearly.
so 10,000,000*30=300,000,000 words. 76*30=2280 megabyte=2.3gigabyte nearly.
-------------------------------------------------------------------------------
// program to divid the whole 2.3 gigabyte file to 36 parts
//0
#include <iostream>
#include <fstream>
#include <string>
//1
using namespace std;
//2
int main ()
{
// reading IN file
ifstream IN;
IN.open("IN.txt");
// defintions
char no[] = {'a', 'b', 'c', 'd', 'e'};
char no1[] = { '1', '2', '3', '4', '5', '6'};
string name1 = "Part";
string name;
while (! IN.eof() )
{
// names of the output files
for (int i=0; i < 5; i++)
for (int j=0; j< 6; j++)
{
name = name1 + ' ' + no[i] + '_' + no1[j] + ".txt";
string s;
IN >> s;
// ofstream OUT;
ofstream OUT;
OUT.open(name.c_str());
for ( int l=1; l<=10000000; l++)
{OUT << s << endl;
IN >> s;}
}
}
system("pause");
return 0;
}
The Previous Program
The Previous Combinatory Program will result in a very huge text-file whose size is nearly 2.3 Gigabyte.
We have 26 letter.
We need words of length 6.
So, we have 6 slots.
Each can receive 26 letters.
Thus, the final number of words is 26*26*26*26*26*26 = 26^6 = 308,915,776 different words.
This program will take nearly 2 hours using an average computer to finish the 2.3 Gigabyte text file.
We have 26 letter.
We need words of length 6.
So, we have 6 slots.
Each can receive 26 letters.
Thus, the final number of words is 26*26*26*26*26*26 = 26^6 = 308,915,776 different words.
This program will take nearly 2 hours using an average computer to finish the 2.3 Gigabyte text file.
Program To Get The List Of All Possible Combinations Of Length 6 Formed By Letters (a To z)
//0
#include <iostream>
#include <fstream>
//1
using namespace std;
//2
int main ()
{
// creating a text output-file
ofstream output;
output.open("output.txt");
// filling the text files
for (int a=1; a<=26; a++)
for (int b=1; b<=26; b++)
for (int c=1; c<=26; c++)
for (int d=1; d<=26; d++)
for (int e=1; e<=26; e++)
for (int f=1; f<=26; f++)
output << char(a+96) << char(b+96) << char(c+96) << char(d+96) << char(e+96) << char(f+96)<< endl;
// pause the system
system ("PAUSE");
return 0;
}
#
What can you do with the new Windows Live? Find out
#include <iostream>
#include <fstream>
//1
using namespace std;
//2
int main ()
{
// creating a text output-file
ofstream output;
output.open("output.txt");
// filling the text files
for (int a=1; a<=26; a++)
for (int b=1; b<=26; b++)
for (int c=1; c<=26; c++)
for (int d=1; d<=26; d++)
for (int e=1; e<=26; e++)
for (int f=1; f<=26; f++)
output << char(a+96) << char(b+96) << char(c+96) << char(d+96) << char(e+96) << char(f+96)<< endl;
// pause the system
system ("PAUSE");
return 0;
}
#
What can you do with the new Windows Live? Find out
بإذن الله ساحاول انشر اكواد برامج لعمل مكتبة
بسم الله الرحمن الرحيم
بسم الله نبدأ
-------
Note: this is like taking notes for myself.
Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! Try it!
بسم الله نبدأ
-------
Note: this is like taking notes for myself.
Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! Try it!
06 May 2009
05 May 2009
15,783,314$ USAID->LEAD & Diversity
15,783,314$ USAID->LEAD & Diversity
21,882,615$
--------------
37,665,929$ = 212,836,842.75 EGP
21,882,615$
--------------
37,665,929$ = 212,836,842.75 EGP
Sent from my iPod
04 May 2009
Subscribe to:
Posts (Atom)
Archive
-
▼
09
(149)
-
▼
May
(34)
- bubble sorting algorithm
- (سورة البقرة) بصوت الشيخ عبد الباسط عبد الصمد
- www.flickr.com
- First Picture
- To Divid The Huge File.cpp
- The Previous Program
- Program To Get The List Of All Possible Combinatio...
- بإذن الله ساحاول انشر اكواد برامج لعمل مكتبة
- HelpAssistant GU*7Vi73TuKfQM
- this book has no doubts.
- 15,783,314$ USAID->LEAD & Diversity
- Basher El Sabreen
- El7alazona Yama el7alazona
- Betfakar fe eih
- Esloob meen dah ya Morpheus
- Fe el hawa sawa
- Al Ensan (Do you know him well)
- Darkness, the black color, or the lack of light an...
- Bettegry raye7 feen
- The sea is the mirror of the sky!
- The see is like the sky (is it it's reflection?)
- Elward Gameel
- Montain speaks to the sea and to the sky
- Lonely tree with the sun
- 3ellah mn alshgar ( trees family )
- How clouds float? Sob7an Allah
- Beethoven the Baby!
- Baby Beethoven
- Beyakol
- Gameel khales
- Gameel
- Katkota
- Allah 3la Ayam Zaman
- Besm Ellah Nabda'
-
▼
May
(34)