Click here to Skip to main content
15,919,613 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Tab Order Pin
Nishad S13-Sep-07 20:17
Nishad S13-Sep-07 20:17 
QuestionUpgrading old MFC look to .NET look Pin
Mojoturner13-Sep-07 16:42
Mojoturner13-Sep-07 16:42 
AnswerRe: Upgrading old MFC look to .NET look Pin
sps-itsec4613-Sep-07 22:21
sps-itsec4613-Sep-07 22:21 
Questionneed to give the number of middle Pin
youbo13-Sep-07 15:53
youbo13-Sep-07 15:53 
AnswerRe: need to give the number of middle Pin
David Crow13-Sep-07 17:22
David Crow13-Sep-07 17:22 
GeneralRe: need to give the number of middle Pin
youbo13-Sep-07 17:24
youbo13-Sep-07 17:24 
QuestionRe: need to give the number of middle Pin
David Crow14-Sep-07 2:28
David Crow14-Sep-07 2:28 
AnswerRe: need to give the number of middle [modified] Pin
carrivick13-Sep-07 19:23
carrivick13-Sep-07 19:23 
Here you go


void swap(int &a,int &b);<br />
void main()<br />
{<br />
   int array_size=0,k,m,j;<br />
<br />
<br />
   cin>>array_size;<br />
   if(array_size < 1)<br />
      return;<br />
   int*p=new int[array_size];<br />
   for(int i=0;i<array_size;i++)<br />
   {<br />
      cin>>p[i];<br />
   }<br />
   // Lets do a bubble sort<br />
   bool changed = true;<br />
   int bubble_end = array_size - 1;<br />
   while(changed)<br />
   {<br />
      changed = false;<br />
      for(int i=0;i<bubble_end;i++)<br />
      {<br />
         if(p[i] > p[i+1])<br />
         {<br />
            swap(p[i],p[i+1]);<br />
            changed = true;<br />
         }<br />
      }<br />
   }<br />
   if(array_size > 1)<br />
   {<br />
      if(array_size%2==1)<br />
         cout<<p[array_size/2+1];<br />
      else cout<<p[array_size/2]<<p[array_size/2+1];<br />
   }<br />
   else<br />
      cout<<p[0];<br />
<br />
}<br />
void swap(int &a,int &b)<br />
{<br />
   int c;<br />
   c=a;<br />
   a=b;<br />
   b=c;<br />
}





-- modified at 8:50 Saturday 15th September, 2007
GeneralRe: need to give the number of middle Pin
youbo13-Sep-07 20:38
youbo13-Sep-07 20:38 
GeneralRe: need to give the number of middle Pin
carrivick15-Sep-07 2:48
carrivick15-Sep-07 2:48 
QuestionConvert DWORD_PTR back to my object Pin
paresh_joe13-Sep-07 9:48
paresh_joe13-Sep-07 9:48 
AnswerRe: Convert DWORD_PTR back to my object Pin
Michael Dunn13-Sep-07 10:03
sitebuilderMichael Dunn13-Sep-07 10:03 
GeneralRe: Convert DWORD_PTR back to my object Pin
paresh_joe13-Sep-07 17:22
paresh_joe13-Sep-07 17:22 
QuestionRe: Convert DWORD_PTR back to my object Pin
David Crow13-Sep-07 17:24
David Crow13-Sep-07 17:24 
AnswerRe: Convert DWORD_PTR back to my object Pin
carrivick13-Sep-07 19:29
carrivick13-Sep-07 19:29 
GeneralRe: Convert DWORD_PTR back to my object Pin
Michael Dunn13-Sep-07 22:13
sitebuilderMichael Dunn13-Sep-07 22:13 
AnswerRe: Convert DWORD_PTR back to my object Pin
paresh_joe13-Sep-07 19:41
paresh_joe13-Sep-07 19:41 
QuestionWindows XP Memory allocation questions Pin
Budric B.13-Sep-07 5:34
Budric B.13-Sep-07 5:34 
AnswerRe: Windows XP Memory allocation questions Pin
Mark Salsbery13-Sep-07 6:01
Mark Salsbery13-Sep-07 6:01 
AnswerRe: Windows XP Memory allocation questions Pin
Waldermort13-Sep-07 6:16
Waldermort13-Sep-07 6:16 
AnswerRe: Windows XP Memory allocation questions Pin
Nemanja Trifunovic13-Sep-07 6:34
Nemanja Trifunovic13-Sep-07 6:34 
GeneralRe: Windows XP Memory allocation questions Pin
Budric B.13-Sep-07 7:41
Budric B.13-Sep-07 7:41 
QuestionDatabase Embedding Pin
perrin486913-Sep-07 5:12
perrin486913-Sep-07 5:12 
QuestionRe: Database Embedding Pin
Maximilien13-Sep-07 5:47
Maximilien13-Sep-07 5:47 
AnswerRe: Database Embedding Pin
perrin486913-Sep-07 7:02
perrin486913-Sep-07 7:02 

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.