Click here to Skip to main content
15,886,110 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Array indexes Pin
Nelek11-Apr-10 0:26
protectorNelek11-Apr-10 0:26 
AnswerRe: Array indexes Pin
Saurabh.Garg11-Apr-10 2:01
Saurabh.Garg11-Apr-10 2:01 
AnswerRe: Array indexes Pin
Luc Pattyn11-Apr-10 2:15
sitebuilderLuc Pattyn11-Apr-10 2:15 
AnswerRe: Array indexes Pin
Farraj11-Apr-10 3:04
Farraj11-Apr-10 3:04 
GeneralRe: Array indexes Pin
Luc Pattyn11-Apr-10 3:30
sitebuilderLuc Pattyn11-Apr-10 3:30 
GeneralRe: Array indexes Pin
Farraj11-Apr-10 11:27
Farraj11-Apr-10 11:27 
GeneralRe: Array indexes Pin
Luc Pattyn11-Apr-10 11:47
sitebuilderLuc Pattyn11-Apr-10 11:47 
GeneralRe: Array indexes Pin
Farraj14-Apr-10 8:30
Farraj14-Apr-10 8:30 
I did understand Luc
thank you for your help

this is my code for now

#include <stdio.h>
#define N 5
void main() 
{
			   
	int a[N];
	int index[N];
	int i,j,temp;
	int count=0;

	for(i=0; i<N; i++)
		{	//set the values of array a[]
			scanf("%d",&a[i]);
			//initializing the index[] array from 0->N-1
			index[i]=count++;
		}

	
	for(i=0; i<N; i++)
	{
				for(j=0; j<N-1; j++)
				{
					if(a[j]>a[j+1])
					{
						temp = index[j+1];
						index[j+1] = index[j];
						index[j] = temp;	
						
											
					}
				}
	}


for (i = 0; i < N; ++i)
{
	printf("%d ",index[i]);
}
flushall();
getchar();

}


i think it should work perfectly, its just it doesnt !! though it looks exactly how it should be
can u run it and tell me where is the problem please?

Thanks.
GeneralRe: Array indexes Pin
Farraj14-Apr-10 8:34
Farraj14-Apr-10 8:34 
GeneralRe: Array indexes Pin
Luc Pattyn14-Apr-10 8:34
sitebuilderLuc Pattyn14-Apr-10 8:34 
GeneralRe: Array indexes Pin
Farraj14-Apr-10 8:35
Farraj14-Apr-10 8:35 
AnswerRe: Array indexes Pin
Chris Losinger11-Apr-10 5:07
professionalChris Losinger11-Apr-10 5:07 
QuestionHow to fully custom draw combobox control, edit, arrow button and listbox included? Pin
kcynic10-Apr-10 23:16
kcynic10-Apr-10 23:16 
AnswerRe: How to fully custom draw combobox control, edit, arrow button and listbox included? Pin
Code-o-mat11-Apr-10 1:07
Code-o-mat11-Apr-10 1:07 
GeneralRe: How to fully custom draw combobox control, edit, arrow button and listbox included? Pin
kcynic11-Apr-10 4:41
kcynic11-Apr-10 4:41 
GeneralRe: How to fully custom draw combobox control, edit, arrow button and listbox included? Pin
Code-o-mat11-Apr-10 6:20
Code-o-mat11-Apr-10 6:20 
GeneralRe: How to fully custom draw combobox control, edit, arrow button and listbox included? Pin
kcynic11-Apr-10 14:31
kcynic11-Apr-10 14:31 
QuestionHow do I segment an image in different colors? Pin
lilliana10-Apr-10 19:06
lilliana10-Apr-10 19:06 
QuestionRe: How do I segment an image in different colors? Pin
Tim Craig10-Apr-10 19:32
Tim Craig10-Apr-10 19:32 
AnswerRe: How do I segment an image in different colors? Pin
Saurabh.Garg11-Apr-10 2:04
Saurabh.Garg11-Apr-10 2:04 
AnswerRe: How do I segment an image in different colors? Pin
@Intersect☺™12-Apr-10 20:50
professional@Intersect☺™12-Apr-10 20:50 
QuestionIPersistFile::Save fails Error Access Denied Pin
ShilpiP10-Apr-10 17:56
ShilpiP10-Apr-10 17:56 
AnswerRe: IPersistFile::Save fails Error Access Denied Pin
Adam Roderick J10-Apr-10 20:59
Adam Roderick J10-Apr-10 20:59 
GeneralRe: IPersistFile::Save fails Error Access Denied Pin
ShilpiP11-Apr-10 5:52
ShilpiP11-Apr-10 5:52 
QuestionUsing a Dialog as a Control in another Dialog Pin
Bram van Kampen10-Apr-10 17:24
Bram van Kampen10-Apr-10 17:24 

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.