哪个C++高手帮我看一下程序,我不知道哪里出错了~!

来源:百度知道 编辑:UC知道 时间:2024/06/08 20:32:18
我自己编的一道注册程序.但是还没编完.不知道为什么出错,但编译时说主程序中的语句错误,请大虾们帮个忙看一下.小弟万分感谢`!
//2.cpp 为主程序
#include<iostream.h>
void main()
{
name bb;
bb.inname();
}

//1.h 为头文件
class name
{
public:
int inname();
void pawr();
void denglu();
char name1[8],password[12],pw[12];
private:
int i,j,k;
};

//1.cpp 为程序
#include<iostream.h>
#include<conio.h>
#include"1.h"
int name::inname();
{
// name aa;
cout<<"用户名只能为1-8位 请输入用户名:";
for(i=0;i<8;i++)
name1[i]=getch();
cout<<endl;
for(j=0;j<=3;j++)
{
if(j==3)
{
cout<<"输出入三次密码都不想同请重新注册~!"<<endl;
return 0;
break;
}
// aa.pawr();
pawr();
for(i=0;i<12;i++)
if(passwore[i]!=pw[i])
cout<<"您输入的两次密码不相同请重新输入~!"<<endl;
else

1.cpp中int name::inname();后面不需要分号
拼写错误:password

另外对你的 1.cpp修改为一下的代码以后可以运行通过,
功能可以实现:
#include<iostream.h>
#include<conio.h>
#include"1.h"
int name::inname()
{
// name aa;
cout<<"user name should be 1-8bit,input "<<endl;

for(i=0;i<8;i++) {
name1[i]=getche();
}
cout<<endl;

pawr();
for(i=0;i<12;i++)
if(password[i]!=pw[i]) {
cout<<"the password is not the same please register again!!"<<endl;
return 0;}
else
{
cout<<"注册成功~!"<<endl;
cout<<"注册信息如下:"<<endl;
cout<<"user name:";
for(i=0;i<8;i++)
cout<<name1[i];
cout<<"password :";
for(i=0;i<12;i++)
cout<<pw[i];
return 1;