Question

Complete the second PrintSalutation function to print the following given personName Holly and customSalutation Welcome:
0 0
Add a comment Improve this question Transcribed image text
Answer #1

CODE -

#include<iostream>

#include<string>

using namespace std;

void PrintSalutation(string personName) {

    // Displaying the salutation "Hello" with the person name passed as parameter

    cout << "Hello, " << personName << endl;

}

void PrintSalutation(string personName, string customSalutation) {

    // Displaying the salutation passed as second parameter with the person name passed as first parameter

    cout << customSalutation << ", " << personName << endl;

}

int main() {

    PrintSalutation("Holly", "Welcome");

    PrintSalutation("Sanjiv");

    return 0;

}

SCREENSHOT -

File Edit Selection View Go Run Terminal Help salutation.cpp - cpp - Visual Studio Code x Et salutation.cpp X 1 2 #include<io

If you have any doubt regarding the solution, then do comment.
Do upvote.

Add a comment
Know the answer?
Add Answer to:
Complete the second PrintSalutation function to print the following given personName "Holly' and customSalutation "Welcome": Welcome,...
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
  • CHALLENGE ACTIVITY 13.1.2: Basic function call. Complete the function definition to output the hours given minutes....

    CHALLENGE ACTIVITY 13.1.2: Basic function call. Complete the function definition to output the hours given minutes. Output for sample program: 3.5 1 test passed All tests passed 1 #include <iostream> 2 using namespace std; 3 4 void OutputMinutesAsHours (double origMinutes) { 5 6 /* Your solution goes here */ 7 8} 9 10 int main() { 11 double minutes; 12 13 cin >> minutes; 14 15 OutputMinutesAsHours (minutes); // Will be run with 210.0, 3600.0, and 0.0. 16 cout <<...

  • CHALLENGE ACTIVITY 8.4.2: Find char in C string Assign a pointer to any instance of searchChar...

    CHALLENGE ACTIVITY 8.4.2: Find char in C string Assign a pointer to any instance of searchChar in personName to searchResult. #include <iostream> #include <cstring> using namespace std; int main() { char personName[100]; char searchChar; char* searchResult = nullptr; cin.getline(personName, 100); cin >> searchChar; /* Your solution goes here */ if (searchResult != nullptr) { cout << "Character found." << endl; } else { cout << "Character not found." << endl; } return 0; }

  • This is C++ I only can change the lines highlighted in white (i can add lines...

    This is C++ I only can change the lines highlighted in white (i can add lines to it with enter though) Set hasDigit to true if the 3-character passCode contains a digit. 1 #include <iostream» 2 #include <string> 3 #include <cctype> 4 using namespace std; 6 int main 7 bool hasDigit; 8 string passCode; 10 hasDigit false; 11 cin passCode; 12 13 Your solution goes here 14 15 if ChasDigit) 16 cout << "Has a digit." < endl; 17 18...

  • 3.3.2: If-else statements. C++ Print "userNum1 is negative." if userNum1 is less than 0. End with...

    3.3.2: If-else statements. C++ Print "userNum1 is negative." if userNum1 is less than 0. End with newline. Assign userNum2 with 1 if userNum2 is greater than 12. Otherwise, print "userNum2 is less or equal 12.". End with newline. #include <iostream> using namespace std; int main() { int userNum1; int userNum2; cin >> userNum1; cin >> userNum2; /*answer goes here*/ cout << "userNum2 is " << userNum2 << endl; return 0; }

  • Write a C++ Program. You have a following class as a header file (dayType.h) and main()....

    Write a C++ Program. You have a following class as a header file (dayType.h) and main(). #ifndef H_dayType #define H_dayType #include <string> using namespace std; class dayType { public:     static string weekDays[7];     void print() const;     string nextDay() const;     string prevDay() const;     void addDay(int nDays);     void setDay(string d);     string getDay() const;     dayType();     dayType(string d); private:     string weekDay; }; #endif /* // Name: Your Name // ID: Your ID */ #include <iostream>...

  • 5.9.2: Modify a string parameter. C++ Complete the function to replace any period by an exclamation...

    5.9.2: Modify a string parameter. C++ Complete the function to replace any period by an exclamation point. Ex: "Hello. I'm Miley. Nice to meet you." becomes: "Hello! I'm Miley! Nice to meet you!" #include <iostream> #include <string> using namespace std; void MakeSentenceExcited(string& sentenceText) { /* Your solution goes here */ } int main() { string testStr; getline(cin, testStr); MakeSentenceExcited(testStr); cout << testStr; return 0; }

  • previous assignment code /*C++ test program to test the classes, Animal, Mammal and Cat and print...

    previous assignment code /*C++ test program to test the classes, Animal, Mammal and Cat and print the results on console window.*/ //Main.cpp //include header files #include<iostream> //include Animal, Mammal and Cat header files #include "Animal.h" #include "Mammal.h" #include "Cat.h" using namespace std; int main() {    //create Animal object    Animal animal("Dog","Mammal",4);    cout<<"Animal object details"<<endl;    cout<<"Name: "<<animal.getName()<<endl;    cout<<"Type: "<<animal.getType()<<endl;    cout<<"# of Legs: "<<animal.getLegs()<<endl;          cout<<endl<<endl;    //create Cat object    Cat cat("byssinian cat","carnivorous mammal",4,"short...

  • You are to implement a MyString class which is our own limited implementation of the std::string...

    You are to implement a MyString class which is our own limited implementation of the std::string Header file and test (main) file are given in below, code for mystring.cpp. Here is header file mystring.h /* MyString class */ #ifndef MyString_H #define MyString_H #include <iostream> using namespace std; class MyString { private:    char* str;    int len; public:    MyString();    MyString(const char* s);    MyString(MyString& s);    ~MyString();    friend ostream& operator <<(ostream& os, MyString& s); // Prints string    MyString& operator=(MyString& s); //Copy assignment    MyString& operator+(MyString&...

  • Given main(). complete the program to add people to a queue.

     14.11 LAB: Ticketing service (queue) Given main(). complete the program to add people to a queue. The program should read in a list of people's names including "You" (ending with-1), adding each person to the peopleInQueue queue. Then, remove each person from the queue until "You" is at the head of the queue. Include print statements as shown in the example below. Ex. If the input is: Zadie Smith Tom Sawyer You Louisa Alcott -1 the output is: Welcome to the ticketing service... You are number 3 in the queue. Zadie...

  • C++ Write a function so that the main() code below can be replaced by the simpler...

    C++ Write a function so that the main() code below can be replaced by the simpler code that calls function MphAndMinutesToMiles(). Original main(): int main() { double milesPerHour; double minutesTraveled; double hoursTraveled; double milesTraveled; cin >> milesPerHour; cin >> minutesTraveled; hoursTraveled = minutesTraveled / 60.0; milesTraveled = hoursTraveled * milesPerHour; cout << "Miles: " << milesTraveled << endl; return 0; } 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 #include <iostream> using...

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