Please help us help you! What do you get when you run your program? Or, if you're getting compiler or linker errors, what are they?
And just for grins, please tell us what compiler and operating system you're using. RobR -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of COOL DUDE Sent: Thursday, August 26, 2010 2:04 AM To: [email protected] Subject: [c-prog] Help!!! :-( please help me for this program. i'm a beginner. For the below program tell me why it doesn't give the right output. Is there any problem in logic or loop i given. please please please help me! :-( :-( :-( /*write a program to sort five numbers in ascending order*/ /*********************************************************/ #include<iostream.h> #include<conio.h> void main() { int array[5],i,j,temp=0; clrscr(); cout<<"Enter any five number:\n"; for(i=0;i<5;i++) { cin>>array[i]; } for(i=0;i<5;i++) { for(j=1;j<5;j++) { if(array[i]>array[j]) { temp=array[i]; array[i]=array[j]; array[j]=temp; } } } cout<<"The sorted array is:"; for(i=0;i<5;i++) { cout<<"\n"<<array[i]; } getch(); } [Non-text portions of this message have been removed] ------------------------------------ To unsubscribe, send a blank message to <mailto:[email protected]>.Yahoo! Groups Links
