In: Computer Science
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.
// Screenshot of the code
// Sample output
// code to copy
#include<iostream>
#include <string>
using namespace std;
double TheNumber(double);
string TheNumber(string);
int main()
{
string str;
double num;
cout<<"Please string here: ";
cin>>str;
cout<<"Please number here: ";
cin>>num;
cout<<TheNumber(str)<<"\n";
cout<<TheNumber(num);
return 0;
}
string TheNumber(string s){
string s1;
int i=0;
for(i=0;i<10;i++){
s1+=s;
}
return s1;
}
double TheNumber(double d){
return d*10;
}