#include <iostream>
#include <string>
#include <sstream>
usingnamespace std;
void sampleVoidFunction(int n){
cout << "You called the sampleVoidFunction with an argument of " << n << endl;
cout << "[";
for(int i=0;i<n;i++)
cout << "*";
cout << "]" << endl;
}
string sampleStringReturnFunction(int n){
stringstream out;
out << n;
string r = "You called the sampleStringReturnFunction with an argument of " + out.str() + "\r" ;
r += "[";
for(int i=0;i<n;i++)
r += "x";
r += "]\r\n" ;
return r;
}
this what got so far
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
#include <iostream>
#include "sampleFunctions.h"
usingnamespace std;
int main()
{
int n;
cout << "Please enter number: ";
cin >> n;
void sampleVoidFunction(int i);
string sampleStringReturnFunction(int j);
cout << "You called the sampleVoidFunction with an argument of " << n << "[**********] " <<endl;
cout << "You called the sampleStringReturnFunction with an argument of " << n <<
"[xxxxxxxxxx]";
return 0;
}
the output suppose to be something like this
Please enter a number: 10
You called the sampleVoidFunction with an argument of 10
[**********]
You called the sampleStringReturnFunction with an argument of 10
[xxxxxxxxxx]