Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Convert This to C from C++ #include<iostream> using namespace std; void sort( in

ID: 3657108 • Letter: C

Question

Convert This to C from C++


#include<iostream>

using namespace std;

void sort(int sorted[],int size);


int main(){

int *arr;

int N,num,count;


//getsize

cout<<"Enter how many integer you want to enter: ";

cin>>N;


//resize arr

arr=new int[N];



//get arr elements

for(int i=0;i<N;i++){

cout<<"Enter integer "<<i+1<<": ";

cin>>arr[i];

}


sort(arr,N);


cout<<" Number frequency";

for(int i=0;i<N;){

count=1;

num=arr[i];

cout<<endl<<arr[i]<<" ";

while(arr[++i]==num){

count++;

}

cout<<count;

}


//clean up

delete[] arr;


cin.get();

return 0;

}


void sort(int sorted[],int size){

int i,j,temp;


for(i=0;i<size-2;i++){

for(j=0;j<size-1;j++){

if(sorted[j]<sorted[j+1]){

temp=sorted[j];

sorted[j]=sorted[j+1];

sorted[j+1]=temp;

}

}

}

return;

}

Explanation / Answer

/*you may also download the code from.......http://www.2shared.com/file/-uRLP1Xz/SORT1.html*/ #include#include using namespace std; void sort(int sorted[],int size); int main(){ int *arr; int N,num,count; printf("Enter how many integer you want to enter: "); scanf("%d",&N); arr=new int[N]; for(int i=0;i

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote