Question

Plz code in c++ below ----------------------------------- Given a string variable word that has been declared and...

Plz code in c++ below

-----------------------------------

Given a string variable word that has been declared and given a value, write a short code block that tests whether the variable holds the string "programmer". If it does, print the message "Get coding...", otherwise print "Before" or "After" depending on whether the word comes before or after programmer in the dictionary. In all cases, end with a newline.

0 0
Add a comment Improve this question Transcribed image text
Answer #1
if (s == "programmer") {
    cout << "Get coding..." << endl;
} else if(s < "programmer") {
    cout << "Before" << endl;
} else {
    cout << "After" << endl;
}
Add a comment
Know the answer?
Add Answer to:
Plz code in c++ below ----------------------------------- Given a string variable word that has been declared and...
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
  • In C# (sharp) Assuming a string variable named movie Title has already been declared, which one...

    In C# (sharp) Assuming a string variable named movie Title has already been declared, which one of the following statements combines the strings "Hidden" and "Figures" and then assigns the resulting string to the variable? 1. movieTitle="Hidden" + "Figures"; 2. "Hidden" +"Figures" - moveTitle; 3. movie Title("Hidden" +"Figures"); 4. movie title="Hidden" & "Figures": Look at the following code: int distance; // Declare distance as an int double half://Declare half as a double distance = 35; // Assign 35 to distance...

  • Write in C: Assume that an int variable age has been declared and already given a...

    Write in C: Assume that an int variable age has been declared and already given a value and assume that a char variable choice has been declared as well. Assume further that the user has just been presented with the following menu: S: hangar steak, red potatoes, asparagus T: whole trout, long rice, brussel sprouts B: cheddar cheeseburger, steak fries, cole slaw (Yes, this menu really IS a menu!) Write some code that reads a single character (S or T...

  • plz answers these short Qs in python language Q1-Given the String variable address, write an expression...

    plz answers these short Qs in python language Q1-Given the String variable address, write an expression that returns the position of the first occurrence of the String "Avenue" in address. Q2-Write a sequence of statements that finds the first comma in the string associated with the variable line, and associates the variable clause the portion of line up to, but not including the comma. Q3-Assume that sentence is a variable that has been associated with a string consisting of words...

  • Here is the UML for the class Contact -fullName : string -phoneNum: string -emailAddress : string...

    Here is the UML for the class Contact -fullName : string -phoneNum: string -emailAddress : string +Contact()                     //default constructor sets all attribute strings to “unknown”; no other constructor +setName(string name) : void +setPhone(string pn) : void +setEmail(string em) : void +getName() : string +getPhone() : string +getEmail() : string +printContact() : void         //print out the name, phone numbers and email address Create New Project Name your project: CIS247_Lab7_YourLastName. For this exercise, you may use a header file or one file...

  • Create a new program in Mu and save it as ps4.5.2.py and take the code below...

    Create a new program in Mu and save it as ps4.5.2.py and take the code below and fix it as indicated in the comments: # Do not change the line of code below. It's at the top of # the file to ensure that it runs before any of your code. # You will be able to access french_dict from inside your # function. french_dict = {"me": "moi", "hello": "bonjour", "goodbye": "au revoir", "cat": "chat", "dog": "chien", "and": "et"} #...

  • In this lab you will write a spell check program. The program has two input files:...

    In this lab you will write a spell check program. The program has two input files: one is the dictionary (a list of valid words) and the other is the document to be spellchecked. The program will read in the words for the dictionary, then will read the document and check whether each word is found in the dictionary. If not, the user will be prompted to leave the word as is or type in a replacement word and add...

  • Write C++ code that creates an integer variable called number. Dereference a given pointer gPointer and...

    Write C++ code that creates an integer variable called number. Dereference a given pointer gPointer and places that value into the variable number. The pointer gPointer will have been declared and set to point to a value before your code runs. Your code will be placed inside the main function with all the appropriate #includes. After your code runs, the test case will execute the following code: cout << "number = " << number << endl; For example: Test Result...

  • Lab 3 Step One First, create an empty directory for lab3. There is no starter code for this lab. You will be throwing an...

    Lab 3 Step One First, create an empty directory for lab3. There is no starter code for this lab. You will be throwing and catching exceptions in this exercise. Create a file called RuntimeException.h and put the following code in it. #include <string> class RuntimeException { private: string errorMsg; public: RuntimeException(const string& err) { errorMsg = err; } string getMessage() const { return errorMsg; } } Step Two In a new .cpp file in your directory, write a main function...

  • Given an int variable n that has already been declared, write some code in C that repeatedly reads a value into n until at last a number between 1 and 10...

    Given an int variable n that has already been declared, write some code in C that repeatedly reads a value into n until at last a number between 1 and 10 (inclusive) has been entered.

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