Click here to Skip to main content
15,892,927 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Pop-Up in the status bar above a NOTIFYICONDATA icon with MFC Pin
ThatsAlok20-Sep-07 23:16
ThatsAlok20-Sep-07 23:16 
QuestionCDaoRecordset from a stored procedure? [modified] Pin
littleGreenDude20-Sep-07 9:18
littleGreenDude20-Sep-07 9:18 
QuestionRTF to HTML converter Pin
Ali Rafiee20-Sep-07 9:14
Ali Rafiee20-Sep-07 9:14 
Questionhow to include another sort into this program Pin
snoop8220-Sep-07 8:24
snoop8220-Sep-07 8:24 
QuestionRe: how to include another sort into this program Pin
David Crow20-Sep-07 8:29
David Crow20-Sep-07 8:29 
AnswerRe: how to include another sort into this program Pin
snoop8220-Sep-07 8:32
snoop8220-Sep-07 8:32 
QuestionRe: how to include another sort into this program Pin
Maximilien20-Sep-07 8:35
Maximilien20-Sep-07 8:35 
AnswerRe: how to include another sort into this program Pin
snoop8220-Sep-07 8:37
snoop8220-Sep-07 8:37 
the algorithm tat i would like to insert

void selectionSort(int a[], int size)
{
int i, j, min;

for (i = 0; i < size - 1; i++)
{
min = i;
for (j = i+1; j < size; j++)
{
if (a[j] < a[min])
{
min = j;
}
}
swap(a[i], a[min]);
}
}

I need help of how to implement it in here

#include
using namespace std;
#include
#include
#include
#include
#include

typedef int dataType;
int innum[2000];
int size;
int number=0;
int num;
int i;
float b;
int assignment=0;
int compare=0;
int starttime, stoptime, timeused;

struct list
{
int info;
list*link;
};

list *first = NULL;
list *last = NULL;
list *newNode;
list *lhead = NULL;
list *lastnum; //last number
list *firstnum; //first number
list *current;
list *trailCurrent;


void linked()
{
list * newNode = new list;

newNode->info=num;
newNode->link=NULL;

if (first==NULL)
{
first=newNode;
last=newNode;
lhead=newNode;
}
else
{
last->link= newNode;
last= newNode;
}
}


void sort()
{
int tmp, index;

for (int firstnumber=1; firstnumber

if (innum[firstnumber]

{
tmp= innum[firstnumber];
index= firstnumber;
do
{
innum[index]=innum[index-1];
index--;
}
while (index>0 && innum[index-1]>tmp);

innum[index]=tmp;
assignment++;
}
cout<<"\nBelow Are The Sorted Numbers"<<"\n\n";

for(int j=0; j
{
cout<<innum[j]<<"\t";
}

stoptime =="" clock();
timeused="stoptime" -="" starttime;
cout="" <<="" "\ncpu="" time:="" "="" timeused="" 1000="" ms."="" endl;
="" system("pause");
}


int="" main()

{
float="" a;

cout<<"\n*********************";
cout<<"\n*="" 1.="" random="" 20="" *";
cout<<"\n*="" 2.="" 200="" 3.="" 2000="" *";
cout<<"\n*********************";
cout<<"\n*="" 4.="" in="" order="" 5.="" 6.="" 7.="" reverse="" 8.="" 9.="" *";
cout<<"\n*********************";

cout<<"\nplease="" choose="" as="" above:="" ";
cin="">>a;

if (a==1)
{
size=20;
ifstream input ("random20.txt", ios::in);
cout<<"\nBelow Are The Unsorted Numbers\n\n";

for ( i=0; i<20; i++)
{
input>>num;
innum[i]=num;
cout<<num<<"\t";
}
sort();
cout<<"\nnumber of="" comparisons:\t"<<compare<<"\n";
cout<<"\nnumber="" assignment:\t"<<assignment<<"\n\n";
}



if="" (a="=2)
{
size=200;
ifstream" input="" ("random200.txt",="" ios::in);
cout<<"\nunsorted="" numbers\n\n";

for="" (int="" i="0;" i<200;="" i++)
{
input="">>num;
innum[i]=num;
cout<<num<<"\t";
} sort();
cout<<"\nnumber="" of="" comparisons:\t"<<compare<<"\n";
cout<<"\nnumber="" assignment:\t"<<assignment<<"\n\n";
}



if="" (a="=3)
{
size=2000;
ifstream" input="" ("random2000.txt",="" ios::in);
cout<<"\nunsorted="" numbers\n\n";

for="" (int="" i="0;" i<2000;="" i++)
{
input="">>num;
innum[i]=num;
cout<<num<<"\t";
}
sort();
cout<<"\nnumber of="" comparisons:\t"<<compare<<"\n";
cout<<"\nnumber="" assignment:\t"<<assignment<<"\n\n";
}



if="" (a="=4)
{
size=20;
ifstream" input="" ("order20.txt",="" ios::in);
cout<<"\nunsorted="" numbers\n\n";

for="" (int="" i="0;" i<20;="" i++)
{
input="">>num;
innum[i]=num;
cout<<num<<"\t";
}
sort();
cout<<"\nnumber of="" comparisons:\t"<<compare<<"\n";
cout<<"\nnumber="" assignment:\t"<<assignment<<"\n\n";
}



if="" (a="=5)
{
size=200;
ifstream" input="" ("order200.txt",="" ios::in);
cout<<"\nunsorted="" numbers\n\n";

for="" (int="" i="0;" i<200;="" i++)
{
input="">>num;
innum[i]=num;
cout<<num<<"\t";
}
sort();
cout<<"\nnumber of="" comparisons:\t"<<compare<<"\n";
cout<<"\nnumber="" assignment:\t"<<assignment<<"\n\n";
}



if="" (a="=6)
{
size=2000;
ifstream" input="" ("order2000.txt",="" ios::in);
cout<<"\nunsorted="" numbers\n\n";

for="" (int="" i="0;" i<2000;="" i++)
{
input="">>num;
innum[i]=num;
cout<<num<<"\t";
}
sort();
cout<<"\nnumber of="" comparisons:\t"<<compare<<"\n";
cout<<"\nnumber="" assignment:\t"<<assignment<<"\n\n";
}


if="" (a="=7)
{
size=20;
ifstream" input="" ("reverse20.txt",="" ios::in);
cout<<"\nunsorted="" numbers\n\n";

for="" (int="" i="0;" i<20;="" i++)
{
input="">>num;
innum[i]=num;
cout<<num<<"\t";
}
sort();
cout<<"\nnumber of="" comparisons:\t"<<compare<<"\n";
cout<<"\nnumber="" assignment:\t"<<assignment<<"\n\n";
}


if="" (a="=8)
{
size=200;
ifstream" input="" ("reverse200.txt",="" ios::in);
cout<<"\nunsorted="" numbers\n\n";

for="" (int="" i="0;" i<200;="" i++)
{
input="">>num;
innum[i]=num;
cout<<num<<"\t";
}
sort();
cout<<"\nnumber of="" comparisons:\t"<<compare<<"\n";
cout<<"\nnumber="" assignment:\t"<<assignment<<"\n\n";
}



if="" (a="=9)
{
size=2000;
ifstream" input="" ("reverse2000.txt",="" ios::in);
cout<<"\nunsorted="" numbers\n\n";

for="" (int="" i="0;" i<2000;="" i++)
{
input="">>num;
innum[i]=num;
cout<
GeneralRe: how to include another sort into this program Pin
David Crow20-Sep-07 8:46
David Crow20-Sep-07 8:46 
GeneralRe: how to include another sort into this program Pin
snoop8220-Sep-07 8:54
snoop8220-Sep-07 8:54 
QuestionRe: how to include another sort into this program Pin
David Crow20-Sep-07 8:58
David Crow20-Sep-07 8:58 
AnswerRe: how to include another sort into this program Pin
snoop8220-Sep-07 9:01
snoop8220-Sep-07 9:01 
GeneralRe: how to include another sort into this program Pin
David Crow20-Sep-07 10:29
David Crow20-Sep-07 10:29 
JokeRe: how to include another sort into this program Pin
Cedric Moonen20-Sep-07 9:33
Cedric Moonen20-Sep-07 9:33 
GeneralRe: how to include another sort into this program Pin
Dave Kreskowiak20-Sep-07 9:23
mveDave Kreskowiak20-Sep-07 9:23 
GeneralRe: how to include another sort into this program Pin
snoop8220-Sep-07 9:31
snoop8220-Sep-07 9:31 
JokeRe: how to include another sort into this program Pin
Mark Salsbery20-Sep-07 9:34
Mark Salsbery20-Sep-07 9:34 
GeneralRe: how to include another sort into this program Pin
snoop8220-Sep-07 9:35
snoop8220-Sep-07 9:35 
GeneralRe: how to include another sort into this program Pin
Cedric Moonen20-Sep-07 9:37
Cedric Moonen20-Sep-07 9:37 
GeneralRe: how to include another sort into this program Pin
Dave Kreskowiak20-Sep-07 12:41
mveDave Kreskowiak20-Sep-07 12:41 
AnswerRe: how to include another sort into this program Pin
toxcct20-Sep-07 20:53
toxcct20-Sep-07 20:53 
QuestionSQLPassThrough??? Pin
littleGreenDude20-Sep-07 7:49
littleGreenDude20-Sep-07 7:49 
AnswerRe: SQLPassThrough??? Pin
Mark Salsbery20-Sep-07 10:19
Mark Salsbery20-Sep-07 10:19 
QuestionMFC and iostream Pin
xjonil20-Sep-07 7:20
xjonil20-Sep-07 7:20 
AnswerRe: MFC and iostream Pin
jhwurmbach20-Sep-07 7:28
jhwurmbach20-Sep-07 7:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.