#include<iostream>
#include<iomanip>
using namespace std;
class PhoneNumber
{
friend ostream &operator<<(ostream &, const PhoneNumber &);
friend istream &operator>>(istream &, PhoneNumber &);
public:
PhoneNumber()
{
}
private:
string areaCode;
string exchange;
string line;
};
ostream &operator<<(ostream &outPut, const PhoneNumber &number)
{
outPut << "(" <<number.areaCode << ") "
<< number.exchange << "-" <<number.line;
return outPut;
}
istream &operator>>(istream &input, PhoneNumber &number)
{
input.ignore();
input >> setw(3)>>number.areaCode;
input.ignore(2);
input >> setw(3) >> number.exchange;
input.ignore();
input>> setw(4)>> number.line;
return input;
}
int mina()
{
PhoneNumber Phone;
cout<<"Enter Phone Number"<<endl;
cin >> Phone;
cout<<"The Phone Number entered was"<<endl;
cout<<Phone<<endl;
}
Why wont this compile?!
Just a few things that I am seeing from glancing at it on line 40, it should be int main(){
Just a simple typing error
Then you need return 0; in your main.
Omg! thank you all! I'm blind!
And 1 last question, how would you guys go about returning an array from a class member?