Feb 13, 2012 at 1:24pm UTC
what seems to be the problem everything seems al-right with me
#include <iostream>
#include <string>
using namespace std;
//Insert function displayData here
//using std::string;
void displayData(string);
int main()
{
string name, addr1, addr2, postalCode;
name = "Mr R.S.Bopape";
addr1 = "P.O. Box 50741";
addr2 = "Sandton";
postalCode = "2146";
displayData(name, addr1, addr2, postalCode);
return 0;
}
Last edited on Feb 13, 2012 at 1:25pm UTC
Feb 13, 2012 at 1:44pm UTC
The displayData function has two problems:
1) The prototype indicates that it takes a single string, but you're trying to feed it four strings.
2) It doesn't exist. You have to write it.
Feb 13, 2012 at 2:03pm UTC
Not quite sure of what is said on point (2).
Feb 14, 2012 at 11:51am UTC
still have a problem with this program..assistance please
Feb 14, 2012 at 11:54am UTC
We're not psychic. What exactly do you want the function displayData to do?
Do you know how to write a function?
Last edited on Feb 14, 2012 at 11:55am UTC
Feb 14, 2012 at 12:06pm UTC
I can take a guess at what you want here, but I'm reluctant to write the code because I don't think you'll learn from it properly.
If you still have a problem, that indicates you've tried something to get it working. Post your current progress and I'll be happy to take a look.
Feb 14, 2012 at 6:32pm UTC
this is how far i have tried.
#include <iostream>
#include <string>
using namespace std;
void displayData(string name, addr1, addr2, postalCode)
int main()
{
string name, addr1, addr2, postalCode;
name = "Mr R.S.Bopape";
addr1 = "P.O. Box 50741";
addr2 = "Sandton";
postalCode = "2146";
displayData(name, addr1, addr2, postalCode);
return 0;
}
void displayData(string name, addr1, addr2, postalCode)
{
cout<<name, addr1,addr2,postalCode;
}
Feb 14, 2012 at 6:33pm UTC
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
#include <iostream>
#include <string>
using namespace std;
void displayData(string name, string addr1, string addr2, string postalCode);
int main()
{
string name, addr1, addr2, postalCode;
name = "Mr R.S.Bopape" ;
addr1 = "P.O. Box 50741" ;
addr2 = "Sandton" ;
postalCode = "2146" ;
displayData(name, addr1, addr2, postalCode);
return 0;
}
void displayData(string name, string addr1, string addr2, string postalCode)
{
cout<<name << addr1 << addr2 <<postalCode;
}
Last edited on Feb 14, 2012 at 6:35pm UTC
Feb 15, 2012 at 9:29am UTC
i was so close but hey thanks