Can someone take this code and sort of make it into a string sorting type of fil
ID: 658119 • Letter: C
Question
Can someone take this code and sort of make it into a string sorting type of file? I just can't think right now
#include <iostream>
#include <vector>
using namespace std;
int seqSearch(const vector <int> list, int listLength, int searchItem)
{
int loc
bool found = false;
for (loc = 0; loc < listLength; loc++
{
found = true;
break;
}
}
int main()
{ vector<int> arr;
arr.push_back(3);
arr.push_back(-12);
cout << seqSearch (arr, 2, 5) << endl;
return 0;
}
void remove(vector <int> lis, int removeItem)
{
int index;
int temp;
index = seqSearch ( lis, lis.size(), removeItem);
if (index == -1)
cout << " Not there stop looking";
else
{
temp = lis[lis.size() -1];
lis[lis.size()-1] = lis[index];
lis.pop_back();
cout << " Cya ";
Explanation / Answer
#include <iostream>
#include <vector>
using namespace std;
int seqSearch(const vector <int> list, int listLength, int searchItem)
{
int loc;
bool found = false;
for (loc = 0; loc < listLength; loc++)
{
found = true;
break;
}
}
int main()
{ vector<int> arr;
arr.push_back(3);
arr.push_back(-12);
cout << seqSearch (arr, 2, 5) << endl;
return 0;
}
void remove(vector <int> lis, int removeItem)
{
int index;
int temp;
index = seqSearch ( lis, lis.size(), removeItem);
if (index == -1)
cout << " Not there stop looking";
else
{
temp = lis[lis.size() -1];
lis[lis.size()-1] = lis[index];
lis.pop_back();
cout << " Cya ";
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.