I need help with my program. Please put comments in the program so i can learn f
ID: 644111 • Letter: I
Question
I need help with my program. Please put comments in the program so i can learn from you! Thanks!
Maximum amount of points offered, I need comments and the program working perfectly for the points!
This program needs to have the constructors listed in the program explanation and most of the work done in the contructors/definitions
Donation List
Problem Description:
This assignment focus on how an array of pointers can be used to display the contents of a second array in sorted order, without sorting the second array.
American Heart Association, the nation
Explanation / Answer
Donation List
#include<stdio.h>
#include<conio.h>
void main()
{
int arr[100],i,j,element,no,temp;
clrscr();
printf(" Enter the no of Donations: ");
scanf("%d", &no);
for(i=0;i<no;i++)
{
printf(" Enter Element %d: ", i+1);
scanf("%d",&arr[i]);
}
for(i=0;i<no;i++)
{
for(j=i;j<no;j++)
{
if(arr[i] > arr[j])
{
temp=arr[i];
arr[i]=arr[j];
arr[j]=temp;
}
}
}
printf(" Sorted array:");
for(i=0;i<no;i++)
{
printf(" %d",arr[i]);
}
getch();
}
Output:
1
2
3
4
5
6
7
8
9
10
11
12
13
Enter the no of Elements: 5
Enter Element 1: 5
Enter Element 2: 100
Enter Element 3: 5
Enter Element 4: 25
Enter Element 5: 1
Sorted array: 5 5 10 25 100
1
2
3
4
5
6
7
8
9
10
11
12
13
Enter the no of Elements: 5
Enter Element 1: 5
Enter Element 2: 100
Enter Element 3: 5
Enter Element 4: 25
Enter Element 5: 1
Sorted array: 5 5 10 25 100
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.