1>c:\users\kelvin\documents\visual studio 2010\projects\person\person\person.h(16): error C3646: 'Private' : unknown override specifier
1>c:\users\kelvin\documents\visual studio 2010\projects\person\person\person.h(16): error C2590: 'getName' : only a constructor can have a base/member initializer list
1>c:\users\kelvin\documents\visual studio 2010\projects\person\person\person.h(16): error C2533: 'Person' : constructors not allowed a return type
1>c:\users\kelvin\documents\visual studio 2010\projects\person\person\person.h(16): error C2556: 'Person::Person(void)' : overloaded function differs only by return type from 'Person::Person(void)'
1> c:\users\kelvin\documents\visual studio 2010\projects\person\person\person.h(10) : see declaration of 'Person::Person'
1>c:\users\kelvin\documents\visual studio 2010\projects\person\person\person.h(17): error C2275: 'std::string' : illegal use of this type as an expression
1> c:\program files (x86)\microsoft visual studio 10.0\vc\include\xstring(2062) : see declaration of 'std::string'
1>c:\users\kelvin\documents\visual studio 2010\projects\person\person\person.h(17): error C2461: 'Person' : constructor syntax missing formal parameters
1>c:\users\kelvin\documents\visual studio 2010\projects\person\person\person.h(17): error C2146: syntax error : missing ';' before identifier 'Name'
1>c:\users\kelvin\documents\visual studio 2010\projects\person\person\person.h(17): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\kelvin\documents\visual studio 2010\projects\person\person\person.cpp(5): error C2761: '{ctor}' : member function redeclaration not allowed
1>c:\users\kelvin\documents\visual studio 2010\projects\person\person\person.cpp(6): error C2447: '{' : missing function header (old-style formal list?)
1>c:\users\kelvin\documents\visual studio 2010\projects\person\person\person.cpp(10): error C2039: 'getName' : is not a member of 'Person'
1> c:\users\kelvin\documents\visual studio 2010\projects\person\person\person.h(8) : see declaration of 'Person'
1>c:\users\kelvin\documents\visual studio 2010\projects\person\person\person.cpp(12): error C2065: 'N' : undeclared identifier
1>c:\users\kelvin\documents\visual studio 2010\projects\person\person\person.cpp(18): error C2065: 'A' : undeclared identifier
1>c:\users\kelvin\documents\visual studio 2010\projects\person\person\person.cpp(65): fatal error C1075: end of file found before the left brace '{' at 'c:\users\kelvin\documents\visual studio 2010\projects\person\person\person.cpp(23)' was matched
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.53
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
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
|
#include <iostream>
#include "Person.h"
#include <string>
using namespace std ;
Person::Person(string N,string A);
{
N=Name;
A=Age;
} string Person::getName()
{
return N;
}
int Person::getAge()
{
return A;
}
int main()
{
int n,A;
string N;
{
cout <<"Enter the number of your siblings or friends"<< endl;
cin >> n;
int*MyS=new int[n];
string*MyN=new string[n];
int*MyA=new int[n];
cout <<"Now for each of your sibling,enter their name and age"<<endl;
cin>>N;
cin>>A;
for(int i=0;i<n;i++)
{
cin>>N;
cin>>A;
MyN[i];
MyA[i];
}
cout<<"The names and ages of my sibling are:"<<endl;
for(int i=0;i<n;i++)
cout<<MyN[i]<<MyA[i]<<endl;
delete []MyS;
};
|