Question

50 MARKS TOTAL 3 Marks Question 1 If word c is present in array w of words, the following method is intended to return the in
0 0
Add a comment Improve this question Transcribed image text
Answer #1

in the function defination
String w is of type string , not array
It needs to be of type array in order for the code to compile

int match(String[] w,int n,String c)
instead of
int match(String w,int n,String c)

Add a comment
Know the answer?
Add Answer to:
50 MARKS TOTAL 3 Marks Question 1 If word c is present in array w of...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • The function takes three parameters: string array, int arraySize, and string word The function will loop...

    The function takes three parameters: string array, int arraySize, and string word The function will loop through the string array. If word is found in the array, return the matched element’s position (index) in the array. Otherwise, return -1. When a match is found in the array, the loop should be terminated at the time --- no need to continue the loop. If no match is found, the function should display all elements in the array, as well as the...

  • ************************CODE SHOULD BE WRITTEN IN C++*************************** TASK: "Given a sorted array of String and a String...

    ************************CODE SHOULD BE WRITTEN IN C++*************************** TASK: "Given a sorted array of String and a String x, find index of x if it is present in the array." *************************USE THE FUNCTION*********************************************************************** #include "problem2.h" // Return index of x if it is present in arr[], // else return -1 int binarySearch(char* arr[], char* x, int n) { //WRITTEN CODE return -1; } ******************************EXAMPLE****************************************************************************** Input : arr[] = { "contribute", "geeks", "ide", "practice"}, x = "ide" Output : 2 The String x...

  • QUESTION 1 Using the following declarations and a member of the Array class, int [ ]...

    QUESTION 1 Using the following declarations and a member of the Array class, int [ ] bArray = new int [10]; int location; Using a method in the Array class, write a statement that would change the order of the elements in the bArray array. The contents of the first cell should hold what was in the last cell. The second cell should hold what was in the next to last cell. __________________________ HINT: You must write the full statement...

  • Hi I really need help with the methods for this lab for a computer science class....

    Hi I really need help with the methods for this lab for a computer science class. Thanks Main (WordTester - the application) is complete and only requires uncommenting to test the Word and Words classes as they are completed. The needed imports, class headings, method headings, and block comments are provided for the remaining classes. Javadocs are also provided for the Word and Words classes. Word The Word class represents a single word. It is immutable. You have been provided...

  • Need help in c++ programming to output the lines in my code: if word if found:...

    Need help in c++ programming to output the lines in my code: if word if found:            cout << "'" << word << "' was found in the grid" << endl;            cout << "'" << word << "' was not found in the grid" << endl; The words can be touching if they are horizontally, vertically, or diagonally adjacent. For example, the board: Q W E R T A S D F G Z X C V B Y U A...

  • May i ask for help with this c++ problem? this is the code i have for assignment 4 question 2: #...

    may i ask for help with this c++ problem? this is the code i have for assignment 4 question 2: #include<iostream> #include<string> #include<sstream> #include<stack> using namespace std; int main() { string inputStr; stack <int> numberStack; cout<<"Enter your expression::"; getline(cin,inputStr); int len=inputStr.length(); stringstream inputStream(inputStr); string word; int val,num1,num2; while (inputStream >> word) { //cout << word << endl; if(word[0] != '+'&& word[0] != '-' && word[0] != '*') { val=stoi(word); numberStack.push(val); // cout<<"Val:"<<val<<endl; } else if(word[0]=='+') { num1=numberStack.top(); numberStack.pop(); num2=numberStack.top(); numberStack.pop();...

  • Problem 1: (20 marks) Part 1: (15 points) Compile the RISC-V assembly code for the following C co...

    please code using risc-v language and make it as simple as possible Problem 1: (20 marks) Part 1: (15 points) Compile the RISC-V assembly code for the following C code. Assume that n and k are passed in x3 and x4 respectively. Values n and k are initialized to 14 and 14. Assume that result returned in register fl and that double precision numbers are used. After you are done store the result in address: 12(x3). Are you allowed to?...

  • I’m giving you code for a Class called GenericArray, which is an array that takes a...

    I’m giving you code for a Class called GenericArray, which is an array that takes a generic object type. As usual this is a C# program, make a new console application, and for now you can stick all of this in one big file. And a program that will do some basic stuff with it Generic Array List What I want you to do today: Create methods for the GenericArray, Easy(ish): public void Append (T, value) { // this should...

  • sort.c #include <stdlib.h> #include <stdio.h> #include "libsort.h" int main() {     int* array;     int size,...

    sort.c #include <stdlib.h> #include <stdio.h> #include "libsort.h" int main() {     int* array;     int size, c;     float median;     printf("Enter the array size:\n");     scanf("%d", &size);     array = (int*) malloc(size * sizeof(int));     printf("Enter %d integers:\n", size);     for (c = 0; c < size; c++)         scanf("%d", &array[c]);     sort(array, size);     printf("Array sorted in ascending order:\n");     for (c = 0; c < size; c++)         printf("%d ", array[c]);     printf("\n");     median = find_median(array,...

  • write a program which include a class containing an array of words (strings).The program will search...

    write a program which include a class containing an array of words (strings).The program will search the array for a specific word. if it finds the word:it will return a true value.if the array does not contain the word. it will return a false value. enhancements: make the array off words dynamic, so that the use is prompter to enter the list of words. make the word searcher for dynamic, so that a different word can be searched for each...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT