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

*PLEASE READ FIRST* I need this progrm to run. All the help ive gotten has been

ID: 3535246 • Letter: #

Question

*PLEASE READ FIRST*

I need this progrm to run. All the help ive gotten has been great but Im still recieving build errors. Please check back to see if it ran or not. If it doesnt run 2 stars will be given and I will comment asking for more help. Thank you!

What goes in the elements input when running the program?

^^^^^^^thats all i need!

Give me a sample run input and output and 1500 points will be yours!

Write a program to test the function seqOrderedSearch. Use either the function bubbleSort or selectionSort to sort the list before the search.

#include "stdafx.h"

#include<iostream>


using


namespace std;


void


bubblesort (int list[],int length);


int


seqsearch(int list[],int len,int ele);


void


main()


{


int list[20],n,i;



int search;



int ele;


cout<<


"Enter the size of the list:";


cin>>n;


cout<<


"Enter elements:";


for(i=0;i<n;i++)


{


cin>>list[i];


}


cout<<


"Enter element to look up:" ;


cin>> ele;


bubblesort (list,n) ;


search=seqsearch(list,n,ele);


if(search==-1)


{


cout<<


"Search Was Unsuccessful";


}


else


cout<<


"Element Found at:"<<search;


system(


"pause");


}


void


bubblesort (int list[],int size)


{


int temp, i,j;


for(i=0;i<size;i++)


{


for (j=i,j<size;j++;)


{


if (list [j]>list[j+1])


{


temp=list[j];


list[j]=list[j+1];


list[j+1]=temp;


}


}


}


}


int


seqsearch (int list [], int size, int element)


{


int loc;


bool found = false;


for(loc=0 ; loc<size;loc++)


{


if(list[loc]>=element)


{


found=


true;


break;


}


}


if(found)


if(list[loc]==element)


return loc;


else


return -1;


else


return -1;


}

Explanation / Answer

Please rate with 5 stars :)


Again, please dont misjudge...because of that warning...i have tested it ...it works !!!


http://ideone.com/xl9NqK


The code is 100% correct..i have spent time to debug it....you bubble sort was wrong earlier....run it in a good compiler...


Cheers!