=1; } 无效塞图安(国际大学); { NoOfUsers>=0; UAN>=1; Name=Null; } 属性门户(整数编号、整数u、字符*n) { NoOfUsers>=否; UAN=u 名称=VU房地产; } 属性门户(整数编号、整数u、字符*n) { NoOfUsers>=否; UAN=u Name=n; } void setNoOfUsers(内部编号) 无效塞图安(国际大学) 无效集合名(字符n) int getNoOfUsers() int getUAN() char getName() int getPropertyInfo(); 类属性类型 { 私人: 查尔*城市 公众: 无效集度(字符c); chargetcity(charc); void getPropertyType(); PropertyType(); 属性类型(char); ~PropertyType(); PropertyType(); { 城市=空 } 属性类型(字符*cCity) { 城市=城市 } }; 类别:商业地产类型 { 私人: int属性值 公众: void setPropertyValue(); int getPropertyValue(); void getPlots(); 商业(); 商业(char); ~Commercial(); }; 类别:住宅物业类别 私人: int属性值; 公众: void setPropertyValue(); int getPropertyValue(); int getPropertyCategory(); }; 空干管() { cout,c++,C++" /> =1; } 无效塞图安(国际大学); { NoOfUsers>=0; UAN>=1; Name=Null; } 属性门户(整数编号、整数u、字符*n) { NoOfUsers>=否; UAN=u 名称=VU房地产; } 属性门户(整数编号、整数u、字符*n) { NoOfUsers>=否; UAN=u Name=n; } void setNoOfUsers(内部编号) 无效塞图安(国际大学) 无效集合名(字符n) int getNoOfUsers() int getUAN() char getName() int getPropertyInfo(); 类属性类型 { 私人: 查尔*城市 公众: 无效集度(字符c); chargetcity(charc); void getPropertyType(); PropertyType(); 属性类型(char); ~PropertyType(); PropertyType(); { 城市=空 } 属性类型(字符*cCity) { 城市=城市 } }; 类别:商业地产类型 { 私人: int属性值 公众: void setPropertyValue(); int getPropertyValue(); void getPlots(); 商业(); 商业(char); ~Commercial(); }; 类别:住宅物业类别 私人: int属性值; 公众: void setPropertyValue(); int getPropertyValue(); int getPropertyCategory(); }; 空干管() { cout,c++,C++" />

c+中的生成错误+;代码 < >我有以下C++代码,我在里面有生成错误。我无法找出错误,请大家帮忙。这里是代码< /p> #include<stdlib.h> #include <iostream.h> using namespace std; class PropertyPortal; class PropertyType; class Commercial; class Residential; void main() class PropertyPortal { private: int NoOfUsers; int UAN; char* Name; public: void setNoOfUsers(int no); void setUAN(int u); void setName(int n); int getNoOfUsers(); int getUAN(); char getName(); int getPropertyInfo(); //constructors of the class PropertyPortal(); PropertyPortal(int, int, char); //destructor of the class ~PropertyPortal (); void setNoOfUsers(int no) { NoOfUsers>=1; } void setUAN (int u); { NoOfUsers>=0; UAN>=1; Name=Null; } PropertyPortal (int no, int u, char* n) { NoOfUsers>=no; UAN=u Name=VU-Real-Estate; } PropertyPortal (int no, int u, char* n) { NoOfUsers>=no; UAN=u Name=n; } void setNoOfUsers(int no) void setUAN(int u) void setName(char n) int getNoOfUsers() int getUAN() char getName() int getPropertyInfo(); class PropertyType { private: char* City public: void setCity(char c); char getCity(char c); void getPropertyType(); PropertyType(); PropertyType(char); ~PropertyType(); PropertyType(); { City=Null } PropertyType(char* cCity) { City=cCity } }; class Commercial:PropertyType { private: int PropertyValue public: void setPropertyValue(); int getPropertyValue(); void getPlots(); Commercial(); Commercial(char); ~Commercial(); }; class Residential:PropertyType private: int PropertyValue; public: void setPropertyValue(); int getPropertyValue(); int getPropertyCategory(); }; void main () { cout<<"This is just a prototype of all classes"; cout<<endl; system("PAUSE"); } #包括 #包括 使用名称空间std; 类属性门户; 类属性类型; 商务舱; 二级住宅; void main() 类属性门户 { 私人: 内特NoOfUsers; 国际组织; 字符*名称; 公众: 无效设置模糊器(内部编号); 无效塞图安(国际大学); 无效集合名(int n); int getNoOfUsers(); int getUAN(); char getName(); int getPropertyInfo(); //类的构造函数 PropertyPortal(); 属性门户(int,int,char); //类的析构函数 ~PropertyPortal(); void setNoOfUsers(内部编号) { NoOfUsers>=1; } 无效塞图安(国际大学); { NoOfUsers>=0; UAN>=1; Name=Null; } 属性门户(整数编号、整数u、字符*n) { NoOfUsers>=否; UAN=u 名称=VU房地产; } 属性门户(整数编号、整数u、字符*n) { NoOfUsers>=否; UAN=u Name=n; } void setNoOfUsers(内部编号) 无效塞图安(国际大学) 无效集合名(字符n) int getNoOfUsers() int getUAN() char getName() int getPropertyInfo(); 类属性类型 { 私人: 查尔*城市 公众: 无效集度(字符c); chargetcity(charc); void getPropertyType(); PropertyType(); 属性类型(char); ~PropertyType(); PropertyType(); { 城市=空 } 属性类型(字符*cCity) { 城市=城市 } }; 类别:商业地产类型 { 私人: int属性值 公众: void setPropertyValue(); int getPropertyValue(); void getPlots(); 商业(); 商业(char); ~Commercial(); }; 类别:住宅物业类别 私人: int属性值; 公众: void setPropertyValue(); int getPropertyValue(); int getPropertyCategory(); }; 空干管() { cout

c+中的生成错误+;代码 < >我有以下C++代码,我在里面有生成错误。我无法找出错误,请大家帮忙。这里是代码< /p> #include<stdlib.h> #include <iostream.h> using namespace std; class PropertyPortal; class PropertyType; class Commercial; class Residential; void main() class PropertyPortal { private: int NoOfUsers; int UAN; char* Name; public: void setNoOfUsers(int no); void setUAN(int u); void setName(int n); int getNoOfUsers(); int getUAN(); char getName(); int getPropertyInfo(); //constructors of the class PropertyPortal(); PropertyPortal(int, int, char); //destructor of the class ~PropertyPortal (); void setNoOfUsers(int no) { NoOfUsers>=1; } void setUAN (int u); { NoOfUsers>=0; UAN>=1; Name=Null; } PropertyPortal (int no, int u, char* n) { NoOfUsers>=no; UAN=u Name=VU-Real-Estate; } PropertyPortal (int no, int u, char* n) { NoOfUsers>=no; UAN=u Name=n; } void setNoOfUsers(int no) void setUAN(int u) void setName(char n) int getNoOfUsers() int getUAN() char getName() int getPropertyInfo(); class PropertyType { private: char* City public: void setCity(char c); char getCity(char c); void getPropertyType(); PropertyType(); PropertyType(char); ~PropertyType(); PropertyType(); { City=Null } PropertyType(char* cCity) { City=cCity } }; class Commercial:PropertyType { private: int PropertyValue public: void setPropertyValue(); int getPropertyValue(); void getPlots(); Commercial(); Commercial(char); ~Commercial(); }; class Residential:PropertyType private: int PropertyValue; public: void setPropertyValue(); int getPropertyValue(); int getPropertyCategory(); }; void main () { cout<<"This is just a prototype of all classes"; cout<<endl; system("PAUSE"); } #包括 #包括 使用名称空间std; 类属性门户; 类属性类型; 商务舱; 二级住宅; void main() 类属性门户 { 私人: 内特NoOfUsers; 国际组织; 字符*名称; 公众: 无效设置模糊器(内部编号); 无效塞图安(国际大学); 无效集合名(int n); int getNoOfUsers(); int getUAN(); char getName(); int getPropertyInfo(); //类的构造函数 PropertyPortal(); 属性门户(int,int,char); //类的析构函数 ~PropertyPortal(); void setNoOfUsers(内部编号) { NoOfUsers>=1; } 无效塞图安(国际大学); { NoOfUsers>=0; UAN>=1; Name=Null; } 属性门户(整数编号、整数u、字符*n) { NoOfUsers>=否; UAN=u 名称=VU房地产; } 属性门户(整数编号、整数u、字符*n) { NoOfUsers>=否; UAN=u Name=n; } void setNoOfUsers(内部编号) 无效塞图安(国际大学) 无效集合名(字符n) int getNoOfUsers() int getUAN() char getName() int getPropertyInfo(); 类属性类型 { 私人: 查尔*城市 公众: 无效集度(字符c); chargetcity(charc); void getPropertyType(); PropertyType(); 属性类型(char); ~PropertyType(); PropertyType(); { 城市=空 } 属性类型(字符*cCity) { 城市=城市 } }; 类别:商业地产类型 { 私人: int属性值 公众: void setPropertyValue(); int getPropertyValue(); void getPlots(); 商业(); 商业(char); ~Commercial(); }; 类别:住宅物业类别 私人: int属性值; 公众: void setPropertyValue(); int getPropertyValue(); int getPropertyCategory(); }; 空干管() { cout,c++,C++,很多错误都来自于类中同时包含函数声明和定义 class Foo { public: int func(); }; int Foo::func() { return 5; } 或 但不是 我还看到,您打算使用两个构造函数,一个使用默认值,另一个从创建者处获取值。但接下来您要执行以下操作: PropertyPortal (int no, int u, char* n) { NoOfUsers>=no; UAN=u Name=VU-Real-Es

很多错误都来自于类中同时包含函数声明和定义

class Foo
{
    public:
        int func();
};
int Foo::func() { return 5; }

但不是

我还看到,您打算使用两个构造函数,一个使用默认值,另一个从创建者处获取值。但接下来您要执行以下操作:

PropertyPortal (int no, int u, char* n)
{
    NoOfUsers>=no;
    UAN=u
    Name=VU-Real-Estate;
}
PropertyPortal (int no, int u, char* n)
{
    NoOfUsers>=no; 
    UAN=u
    Name=n;
}
我猜你的意思是

PropertyPortal ()
{
    NoOfUsers=1;
    UAN=1;
    Name="VU-Real-Estate";
}
PropertyPortal (int no, int u, char* n)
{
    NoOfUsers=no; 
    UAN=u
    Name=strdup(n); // Remember to free() this later.
}

事实上,您最好将
char*
s全部废弃,并使用
std::string
,或许可以阅读。

完整的错误消息在哪里?该
void main()
行不属于那里(或者几乎不属于任何地方;改用
int main()
)。如果您向我们提供错误消息并标记它们所在的行,以及删除代码中不相关的部分,这会有所帮助。首先,为什么会有
void main()
在顶部附近浮动?首先,你不需要向前声明
main
,即使你这样做了,那行也缺少一个
main
返回
void
是非标准的。它应该是
int
。先生,我使用了int main()但仍然是错误的SAMEGET一本书和学习C++。这个代码充满了琐碎的语法错误。
PropertyPortal (int no, int u, char* n)
{
    NoOfUsers>=no;
    UAN=u
    Name=VU-Real-Estate;
}
PropertyPortal (int no, int u, char* n)
{
    NoOfUsers>=no; 
    UAN=u
    Name=n;
}
PropertyPortal ()
{
    NoOfUsers=1;
    UAN=1;
    Name="VU-Real-Estate";
}
PropertyPortal (int no, int u, char* n)
{
    NoOfUsers=no; 
    UAN=u
    Name=strdup(n); // Remember to free() this later.
}