Question
Asked Sep 9, 2019

In C++

Create two functions called TheNumber. One version of TheNumber should accept a string and output the accepted string 10 times.  The other version of TheNumber should accept a double and output the accepted double 10 times. This uses function overloading.

check_circle

Expert Answer

Step 1

Program code in C++ for creating two functions called TheNumber. One version of the TheNumber function accepts a string and displaying output of the accepted string ten times and the other version is accepting a double number and displaying the output the of accepted double ten times, by using function overloading.

Step 2

Program code:

#include <iostream>

#include <string>

using namespace std;

//Defining function to accept string

void TheNumber(string s)

{

    for(int i = 0; i < 10; i++)

    {

        cout << s << endl;

    }

}

// Defining function to accept double

void TheNumber(double number)

{

    for(int i = 0; i < 10; i++)

    {

        cout << number << endl;

    }

}

//Declaring main function

int main()

{

&nbs...

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in

Engineering

Computer Science

Programing Language

Related Computer Science Q&A

Find answers to questions asked by student like you

Show more Q&A add
question_answer

Q: In C++ Create a function called DieRoll. It should create a random number between 1 and 6 and return...

A: Program AlgorithmDeclare the variable and declare the function prototype as int DieRoll(int low, int...

question_answer

Q: Why does Pinterest view Google as its primary competitor? Why does Pinterest focus on the smartphone...

A: Pinterest is a social media platform whose software system is designed to find and curate informatio...

question_answer

Q: Complete the following list comprehensionlc5 = [ for c in 'bu be you']so that it produces...

A: Let’s define a python function which outputs True if the alphabet is ‘b’ or ‘u’, because the above l...

question_answer

Q: Create a new file in c++.  In this lab, you will add some functionality to the table ofmenu. Your bo...

A: Program Instructions:Declare variables and write a welcome message.Always convert the user's choice ...

question_answer

Q: What is the reason that JK flip flop is often preferred over SR flip flop?

A: SR stands for SET / RESET. SR flip flop is considered as one of the most basic sequential logic circ...

question_answer

Q: Please write Lisp code for the following problem. Consider the list:((name (number1 nation)) (MusicP...

A: Instructions to create a function to access the MovieTixHighPrices value using car and cdr:The funct...

question_answer

Q: What does the group nesting depend on?

A: Group Nesting:A group can have any number of contacts, users, or other groups as members. And the ne...

question_answer

Q: Write a program called LoopMinMax that reads in 4 values from the user and prints the lowest and hig...

A: You didn’t mention which language should be used for the given program. Here, I have used JAVA langu...

question_answer

Q: Hello! I am trying to write a program in Pynthon. Need help. Requirements: Write a .py file like Kev...

A: Program Plan:Import required packagesPrompt the path and the number of characters to delete from the...