Hello every one, This is my 1st post. I have the same assignment as the Thread starter, I figured I would post my question here.
I'm using VB 2010 express to compile and I choose the C++ version.
I know Im missing some things including code in my .cpp definitions of functions, but that's half of where Im confused and I had to run out to take a test, maybe when I get back in 4 hours someone will have some things to add. Thanks in advance. I Could also be reached @ Twitter
Here is my CODE:l
Code:#ifndef PersonType_H #define PersonType_H class PersonType { public: PersonType();//Defualt Constructor PersonType(string, string);//Constructor with parameters void setName(string first, string last);//Function to set firstName and lastName void getName(string& first, string last);//Function to return firstName and lastName through the parameters void print() const; //Function to output the first name and last name private: string firstName; //DataMember first name string lastName; //DataMember last name }; #endif #include "stdafx.h" #include <iostream> #include <cstring> using std::cout; using std::endl; using namespace std; #include "PersonType.h" PersonType::PersonType(string first, string last)//Default constructor; { firstName = fist; //store the first name lastName = last; //store the last name } void personType::setName(string first, string last) { firstName = first; lastName = last; } void PersonType::getName() { } void PersonType::print()const { cout<<firstName<<" "<<lastName; } #include "stdafx.h" using namespace System; #include <cstdlib> #include <iostream> #include "PersonType.h" int main() { PersonType pName(David, Barco); const pName.setName; const pName.getName; const pName.printName; system("PAUSE"); return EXIT_SUCCESS; }
ERRORS:
C++ WA 4 B2.cpp(8): warning C4603: 'PersonType_H' : macro is not defined or definition is different after precompiled header use
Add macro to precompiled header instead of defining here
C++ WA 4 B2.cpp(30) : use of precompiled header
C++ WA 4 B2.cpp(39): fatal error C1083: Cannot open include file: 'PersonType.h': No such file or directory



LinkBack URL
About LinkBacks



