MAIN
Code:
#include <iostream>
#include <string>
#include "checkFile.h"
#include "check.cpp"
using namespace std;
int main(int argc, const char * argv[])
{
addressBook address1("New York Way", "555-555-5554");
addressBook address2("New Jersey Bld","678-979-9999");
std::cout << "The first address is:"<<address1.getAddress()<<"\n"<< address1.getPhoneNum()<<std::endl;
std::cout << "The second address is:"<<address2.getAddress()<<"\n"<< address2.getPhoneNum()<<std::endl;
return 0;
}
.cpp file
Code:
#include <iostream>
#include <string>
#include "checkfile.h"
explicit addressBook::addressBook(string streetaddy, sting phoneNumber)
{
street=streetaddy;
phone=phoneNumber;
}
void addressBook::Address(std::string streetAddy)
{
street = streetAddy;
}
void addressBook::PhoneNum(std::string phoneNumber)
{
phone = phoneNumber;
}
string addressBook::getPhoneNum() const
{
return phone;
}
std::string addressBook::getAddress() const
{
return street;
}
.h file
Code:
//checkFile.h
#ifndef Classes_project_checkFile_h
#define Classes_project_checkFile_h
#include <iostream>
#include <string>
#include "checkfile.h"
class addressBook{
public:
explicit addressBook(std::string streetaddy, std::string phoneNumber)
: street(streetaddy), phone (phoneNumber);
void Address(std::string streetAddy)
{
street = streetAddy;
}
void PhoneNum(std::string phoneNumber)
{
phone = phoneNumber;
}
std::string getPhoneNum() const
{
return phone;
}
std::string getAddress() const
{
return street;
}
private:
std::string street;
std::string phone;
};
#endif
Code:
Errors:
line 13 on checkFile.h Expected { or ','
line 6 .cpp file Expected ';' after top level declatator
If I fix these error a lot more show up. This is frustrating!!!