program help

hi guys i am unable to make my second function work... i know that i am doing something wrong with the whole string thing... some help would be much appreciated. i just want the second function to display the data put into the first function.

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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60

#include <iostream>
#include <string>
using namespace std;

string inputData(string name, string addr1, string addr2, string postalCode);
string displayData(string name, string addr1, string addr2, string postalCode);

int main(){
    
    string  name, addr1, addr2, postalCode;
   
    inputData(name, addr1, addr2, postalCode);
    displayData(name,  addr1,  addr2,  postalCode);
    
    
    return 0;
}


string inputData(string name, string addr1, string addr2, string postalCode){
    
    string dataInput;
    
    cout << "Please input the following data below: " << endl;
    cout << "======================================" << endl;
    
    cout << "Please state your title and name : ";
    cin >> name;
    
    cout << "Please enter your P.O Box number : ";
    cin >> addr1;
    
    cout << "Please enter your town : ";
    cin >> addr2;
    
    cout << "Please enter your postal code : ";
    cin >> postalCode;
    
    cout << endl;

    return dataInput;
}

string displayData(string name, string addr1, string addr2, string postalCode){
    
    string dataDisplay;

    cout << "The address details entered is: " << endl;
    cout << "===============================" << endl;
    cout << name << endl;
    cout << "P.O Box " << addr1 << endl;
    cout << addr2 << endl;
    cout << postalCode << endl;
    
    return dataDisplay;
    
    
}
Topic archived. No new replies allowed.