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

Suppose you created a video project that has two data structures—an array of str

ID: 3673811 • Letter: S

Question

Suppose you created a video project that has two data structures—an array of strings and a ListView control. You used the Sort() method of the array class to put the film names in ascending order. Then the program populated lstNames with the ordered strings from the array.

In this assignment, you will:

Save the program as Elementary.cpp.

Populate the list using a different technique. Within the Form1_Load event, comment out the Sort() method.

Change the Sorting property of lstNames to Ascending.

Change the Sorting property of lstNames to Descending to display the names in lstNames sorted automatically.

Explanation / Answer

#include<iostream.h>

void sortA(String [], ListView);

void sortD(String [],ListView)

int main()

{

String arr[15];

ListView lstnames;

cout<<"enter the filmnames";

for(int i=-;i<arr.size();i++)

{

cin>>arr[i];

}

sortA(arr[],lstNames);

sortD(arr[], lstNames);

return 0;

}

void sortA(String arr[], ListView lstNamet)

{

String temp;

for(int i=0;i<arr.size()-1;i++)

{

for(int j=i+1;j<arr.size();j++)

{

if(strcmp((arr[i],arr[j])>0))

{

strcpy(temp,arr[i]);

strcpy(arr[i],arr[j]);

strcpy(arr[j],temp);

}

}

}

lstname->Itmes->Add(arr);

}

void sortD(String arr[], ListView lstName)

{

String temp;

for(int i=0;i<arr.size()-1;i++)

{

for(int j=i+1;j<arr.size();j++)

{

if(strcmp((arr[i],arr[j])<0))

{

strcpy(temp,arr[i]);

strcpy(arr[i],arr[j]);

strcpy(arr[j],temp);

}

}

}

lstname->Itmes->Add(arr);

}

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