Answered You can hire a professional tutor to get the answer.

QUESTION

Could somebody write these 3 functions using C++? I am stuck in the last one, but I will like to see if I might

#include#include#include#include#include#include <iostream><fstream><cstring><cassert><cstdlib><string> using namespace std;/***** TASK 1 *****/// REQUIRES: str1 and str2 point to C-strings// EFFECTS: If st1 and str2 are identical (contain exactly//the same characters), returns 0.//If the first differing character has a greater//value in st1 than in str2, return a positive number.//Otherwise, return a negative number.int strcmp_eecs280(const char *str1, const char *str2){return 0; // REPLACE THIS LINE WITH YOUR CODE } /***** TASK 2 *****/// EFFECTS: Prompts the user to end a word using the prompt//"Please enter a word: " and then reads a string//from cin which will be returned. After reading the//input, clean up by printing a newline to cout.string getUserWord(){return "quit"; // TASK 2 - REPLACE WITH YOUR CODE} // EFFECTS: Searches words.txt for the word passed as a//parameter. If found, return true. Otherwise false.//If words.txt cannot be opened, prints an error//message to cout and calls exit(1).// NOTE:You MUST use the strcmp_eecs280 function.bool findWord(string word){return false; // TASK 2 - REPLACE WITH YOUR CODE} /***** YOU DO NOT NEED TO MODIFY CODE BELOW THIS POINT *****/// Testing codevoid test_strcmp_eecs280() {assert(strcmp_eecs280("turtle", "frog") > 0);assert(strcmp_eecs280("turtle", "turtles") < 0); assert(strcmp_eecs280("", "frog") < 0);assert(strcmp_eecs280("lizard", "lizard") == 0);}int main(){test_strcmp_eecs280();cout << "Welcome to eecs280 spell checker!" << endl;cout << "You may quit at any time by typing \"quit\"." << endl;for(string userWord = getUserWord(); userWord != "quit"; userWord =getUserWord()){if (findWord(userWord)){cout << "It appears " << userWord << " is spelled correctly!";}else{cout << "Oops. " << userWord << " is not a correctly spelled word!";}} cout << endl << endl; cout << "See you again soon.return 0;} Happy spelling!" << endl;

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question