Functions in Header File teacher barely went over it

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <iostream>
#include <string>
#include <sstream>
using namespace 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"
using namespace 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]
Lines 11& 12:
1
2
void sampleVoidFunction(int i n);
string sampleStringReturnFunction(int j n);
change it but
sampleVoidFunction working
not the sampleStringReturnFunction
And what is not working?
the sampleStringReturnFunction

my output was

Please enter number: 10
You called the sampleVoidFunction with an argument of 10
[**********]

TIMEOUT WAITING FOR: [You called the sampleStringReturnFunction with an argument of 10]
Look at your code. What does the sampleStringReturnFunction() "produce"? What do you do with the "product"?
never mind i got it to work thanks i appreciate the help
Topic archived. No new replies allowed.