Question

In: Computer Science

Create and call a function that prints out a favorite quotation of yours and cites the...

Create and call a function that prints out a favorite quotation of yours and cites the original source. Be sure to use quotes (") around the quotation and make sure the quotes are also printed out, along with the name of the source on the next line, tab indented. "You must be the change you wish to see in the world." – Gandhi.

Solutions

Expert Solution

The programming language is not mentioned in the problem. Therefore, the chosen programming language is C++.

Please specify the programming language with the problem.

Screenshot of the code:

Sample Output:

Code To Copy:

//Include the header file.

#include <iostream>

using namespace std;

//Define the function to display the quote

//with quotes and the source in the next

// line-tab intended.

void display_quote(string s, string source)

{

//Display the quote under the double quotes.

cout <<"\"" << s << "\"" << endl;

//Display the source of the quote in the next line.

//If wanted to be in the same line, remove

//the endl of the above statement.

cout << "- " << source << endl;

}

//Define the main function.

int main() {

//Declare the variables.

string str, source;

//Prompt the user to enter the quote.

cout << "Enter the Quote: ";

getline(cin, str);

//Prompt the user to enter the source.

cout << "Enter the source: ";

getline(cin, source);

//Call the function to display the quote and the source.

display_quote(str, source);

//Return the value for the main function.

return 0;

}

//For any query, please comment. Ready to help!. Kindly give positive ratings.


Related Solutions

Q9) Write a function that asks the user for a number and prints out the multiplication...
Q9) Write a function that asks the user for a number and prints out the multiplication table for that number. Python3 Q10)Write a function that takes two integer inputs for width and length, and prints out a rectangle of stars. (Use * to represent a star). Q11)Write a program that reads in a string and prints whether it: [Hint: given a character like ‘H’ you can apply to it the method ‘H’.isalpha() to check if it is a letter or...
Create and submit a Python program (in a module) that contains a main function that prints...
Create and submit a Python program (in a module) that contains a main function that prints 17 lines of the following text containing your name: Welcome to third week of classes at College, <your name here>! can someone please show me how to do this step by step? I'm just confused and keep getting errors in idle.
Python please! Create one program to include all 10 elements: Create a function that prints a...
Python please! Create one program to include all 10 elements: Create a function that prints a sentence passed to the function as parameter. On the next line, print the same sentence without the 1st and the last character, use string slicing. Use the following sentence: This is the sentence. Given a string: This string was copied in an article. Replace the relevant words to read as follows: This string was discovered in the article xyz. Given a string: This string...
Question 2: Create a method (sortTraversal) for a Binary Search Tree that prints out the Binary...
Question 2: Create a method (sortTraversal) for a Binary Search Tree that prints out the Binary Search Tree in ascending or deceasing order. The order type is an input to the method and can be "ascending" or "descending". The ascending input would return the node values of the tree beginning with the smallest and ending with the largest, descending returns the opposite. Discuss method's Big-O notation. Add proper and consistent documentation to identify code sections or lines to clearly identify...
PYTHON CODING Create a method (sortTraversal) for a Binary Search Tree that prints out the Binary...
PYTHON CODING Create a method (sortTraversal) for a Binary Search Tree that prints out the Binary Search Tree in ascending or deceasing order. The order type is an input to the method and can be "ascending" or "descending". The ascending input would return the node values of the tree beginning with the smallest and ending with the largest, descending returns the opposite. Discuss method's Big-O notation. Add proper and consistent documentation to identify code sections or lines to clearly identify...
Write a function which takes one parameter int num, and prints out a countdown timer with...
Write a function which takes one parameter int num, and prints out a countdown timer with minutes and seconds separated by a colon (:). It should print out one line for each second elapsed and then pause one second before printing out the next line. A few things to note: - You can assume that calling the function usleep(1000000) makes the program pause for one second - It should count down from num minutes:zero seconds to zero minutes:zero seconds -...
USING PYTHON Write a program to create a number list. It will call a function to...
USING PYTHON Write a program to create a number list. It will call a function to calculate the average values in the list. Define main ():                        Declare variables and initialize them                        Create a list containing numbers (int/float)                        Call get_avg function that will return the calculated average values in the list.                                       Use a for loop to loop through the values in the list and calculate avg                        End main()
Matlab program Create a function, when given a two-digit integer as input, prints the equivalent English...
Matlab program Create a function, when given a two-digit integer as input, prints the equivalent English phrase. For example, given 39, output thirty-nine. Limit the input numbers to be in the range 21 to 39.
Using Python create a script called create_notes_drs.py. In the file, define and call a function called...
Using Python create a script called create_notes_drs.py. In the file, define and call a function called main that does the following: Creates a directory called CyberSecurity-Notes in the current working directory Within the CyberSecurity-Notes directory, creates 24 sub-directories (sub-folders), called Week 1, Week 2, Week 3, and so on until up through Week 24 Within each week directory, create 3 sub-directories, called Day 1, Day 2, and Day 3 Bonus Challenge: Add a conditional statement to abort the script if...
Using eclipse IDE, create a java project and call it applets. Create a package and call...
Using eclipse IDE, create a java project and call it applets. Create a package and call it multimedia. Download an image and save it in package folder. In the package, create a java applet where you load the image. Use the drawImage() method to display the image, scaled to different sizes. Create animation in Java using the image. In the same package folder, download a sound. Include the sound in your applets and make it repeated while the applet executes....
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT