写了一个相亲系统,遇到第二步骤相亲查询功能不能实现,不知道是哪里出了问题。求大神指点!
头文件:#pragma once
class man
{
public:
int age;
double length;
string name;
string selfInFo;
string StudyBackground;
string career;
string GRdemand;
int GRage1;
int GRage2;
double GRlength;
void EntreInFo();
void ShowInFo();
void GRInFo();
void GRInFo(int GRage1,int GRage2);
void GRInFo(double GRlength);
void GRInFo(string GRothreInFo);
man(void);
~man(void);
};
#pragma once
class woman
{
public:
int age;
double length;
string name;
string selfInFo;
string StudyBackground;
string career;
string BYdemand;
int BYage1;
int BYage2;
double BYlength;
void EntreInFo();
void ShowInFo();
void BYInFo();
void BYInFo(int BYage1,int BYage2);
void BYInFo(double BYlength);
void BYInFo(string BYothreInFo);
woman(void);
~woman(void);
};
#pragma once
#include"man.h"
#include"woman.h"
const int num=100;
class LOVESYS
{
public:
int select;
string sex;
int mannum;
int womannum;
man manlist[num];
woman womanlist[num];
int startsys();
void allnewman();
void allnewwoman();
void allmanInFo();
void allwomanInFo();
LOVESYS(void);
~LOVESYS(void);
};
源文件:
#include "StdAfx.h"
#include "man.h"
man::man(void)
{
int age=0;
double length=0;
string name="无";
string selfInFo="无";
string StudyBackground="无";
string career="无";
string GRdemand="无";
double GRlength=0;
int GRage1=0;
int GRage2=0;
}
man::~man(void)
{
}
void man::EntreInFo(){
cout<<"请输入您的姓名:";
cin>>this->name;
cout<<"请输入您的年龄:";
cin>>this->age;
cout<<"请输入您的身高:";
cin>>this->length;
cout<<"请输入您的学历:";
cin>>this->StudyBackground;
cout<<"请输入您的职业 :";
cin>>this->career;
cout<<"请输入您的自我性格及爱好描述:";
cin>>this->selfInFo;
cout<<"请输入您对另一半的要求:";
cout<<"1)女生身高不能低于(没有要求填0):";
cin>>this->GRlength;
cout<<"2)女生年龄区间(没有要求填0):";
cin>>this->GRage1>>this->GRage2;
cout<<"3)您对女生还有其他的要求吗?如果没有请输入“无”:";
cin>>this->GRdemand;
cout<<"=====我们会很快将您的信息公布,祝您早日找到您心仪的一半!=====";
}
void man::ShowInFo(){
cout<<"--->这是一位男士的基本信息<---"<<endl;
cout<<"姓名:";
cin>>this->name;
cout<<"年龄:";
cin>>this->age;
cout<<"身高:";
cin>>this->length;
cout<<"学历:";
cin>>this->StudyBackground;
cout<<"职业 :";
cin>>this->career;
cout<<"自我性格及爱好描述:";
cin>>this->selfInFo;
cout<<"对另一半的要求:";
GRInFo(this->GRage1, this->GRage2 );
GRInFo(this->GRlength);
GRInFo( this->GRdemand);
cout<<"=========================";
}
void man::GRInFo(int GFages,int GFagess ){
if(GFages<=0||GFagess<=0){
cout<<"我对女生年龄没有要求!";
}else{
cout<<"我对女生的身年龄区间要求是:"<<GFages<<"--"<<GFagess;
}
}
void man::GRInFo(double length){
if(length<=0){
cout<<"我对女生的身高没有要求!";
}else{
cout<<"我对女生的身高要求不能低于"<<length;
}
}
void man::GRInFo(string GRdemand){
cout<<GRdemand;
}
#include "StdAfx.h"
#include "woman.h"
woman::woman(void)
{
int age=0;
double length=0;
string name="无";
string selfInFo="无";
string StudyBackground="无";
string career="无";
string GRdenamd="无";
int BYage1=0;
int BYage2=0;
double BYlength=0;
}
woman::~woman(void)
{
}
void woman::EntreInFo(){
cout<<"请输入您的姓名:";
cin>>this->name;
cout<<"请输入您的年龄:";
cin>>this->age;
cout<<"请输入您的身高:";
cin>>this->length;
cout<<"请输入您的学历:";
cin>>this->StudyBackground;
cout<<"请输入您的职业 :";
cin>>this->career;
cout<<"请输入您的自我性格及爱好描述:";
cin>>this->selfInFo;
cout<<"请输入您对另一半的要求:";
cout<<"1)男生身高不能低于(没有要求填0):";
cin>>this->BYlength;
cout<<"2)男生年龄区间(没有要求填0):";
cin>>this->BYage1>>this->BYage2;
cout<<"3)您对男生还有其他的要求吗?如果没有请输入“无”:";
cin>>this->BYdemand;
cout<<"=====我们会很快将您的信息公布,祝您早日找到您心仪的一半!=====";
}
void woman::ShowInFo(){
cout<<"--->这是一位女士的基本信息<---"<<endl;
cout<<"姓名:";
cin>>this->name;
cout<<"年龄:";
cin>>this->age;
cout<<"身高:";
cin>>this->length;
cout<<"学历:";
cin>>this->StudyBackground;
cout<<"职业 :";
cin>>this->career;
cout<<"自我性格及爱好描述:";
cin>>this->selfInFo;
cout<<"对另一半的要求:";
BYInFo(this->BYage1, this->BYage2 );
BYInFo(this->BYlength);
BYInFo(this->BYdemand);
cout<<"=========================";
}
void woman::BYInFo(int GFages,int GFagess ){
if(GFages<=0||GFagess<=0){
cout<<"我对男生年龄没有要求!";
}else{
cout<<"我对男生的身年龄区间要求是:"<<GFages<<"--"<<GFagess;
}
}
void woman::BYInFo(double length){
if(length<=0){
cout<<"我对男生的身高没有要求!";
}else{
cout<<"我对男生的身高要求不能低于"<<length;
}
}
void woman::BYInFo(string BYdemand){
cout<<BYdemand;
}
#include "StdAfx.h"
#include "LOVESYS.h"
LOVESYS::LOVESYS(void){
cout<<"====================欢迎使用非诚勿扰相亲系统============================";
cout<<"=====================技术支持来自安徽工程大学软件开发小组=======================";
int select=0;
string sex="无";
int mannum=0;
int womannum=0;
}
void LOVESYS::allnewman(){
man n;
n.EntreInFo();
manlist[mannum]=n;
mannum++;
}
void LOVESYS::allnewwoman(){
woman w;
w.EntreInFo();
womanlist[womannum]=w;
womannum++;
}
void LOVESYS::allmanInFo(){
for(int i=0;i<mannum;i++){
manlist[i].ShowInFo();
}
}
void LOVESYS::allwomanInFo(){
for(int i=0;i<womannum;i++){
womanlist[i].ShowInFo();
}
}
LOVESYS::~LOVESYS(void)
{
}
int LOVESYS::startsys(){
while(1){
man n;
woman w;
cout<<"请选择(1、新建相亲 2、相亲查询 3、退出)";
cin>>this->select;
if(this->select==1){
cout<<"请输入您的性别:";
cin>>this->sex;
if(sex=="男"){
n.EntreInFo();
}else if(sex=="女"){
w.EntreInFo();
}else{
cout<<"您的操作有误!请重新输入!";
}
}else if(this->select==2){
cout<<"大家好";
this->allmanInFo();
this->allwomanInFo();
}else if(this->select==3)
{
cout<<"感谢您的使用,我们将会竭诚为您服务!"<<endl;
return 0;
}else{
cout<<"您的操作有误!请重新输入!";
}
}
}
#include "stdafx.h"
#include"LOVESYS.h"
#include "man.h"
#include"woman.h"
int _tmain(int argc, _TCHAR* argv[])
{
LOVESYS sys;
sys.startsys();
return 0;
}