line 46

line 46 z(); were not declare...why

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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#include<iostream>
using namespace std;
#include<stdio.h>
#include<conio.h>
#include<windows.h>
#include<fstream>
#include<mmsystem.h>

int choice,a,b,i;
int z(),regis(),login(),f1();
char pass[32],pass0[32];
int main()
{
    z();
}


int z()
{
    printf("1.REGISTER\n");
    printf("2.LOGIN\n");
    cin>>choice;
    switch(choice)
    {
    case 1:regis();
        break;
    case 2:login();
        break;
    default:;
    }
}


int regis()
{
    system("cls");
    printf("CREAT PASSWORD=");
    cin>>pass0;
    ofstream taolao;
    taolao.open("icreat.txt");
    taolao<<pass0;
    cout<<endl<<"DONE!";
//    taolao.close();
    //

    Z();
    taolao.close();
}

int login()
{
    system("cls");
    printf("PASSWORD=");
    while(a!=13)
    {
        f1();
        if(a<400&&a!=27&&a!='\b'&&a!='\r'&&a!='\t')
        {
            printf("%c",2);
            pass[i]=a;
            i++;
            Beep(500,60);
        }
        if(a=='\b'&&i>0)
        {
            cout<<"\b \b";
            pass[i]='\0';
            i--;
            Beep(1000,50);
        }
        else{Beep(2000,50);};
    }
    cout<<endl<<pass;
    if(pass==pass0)
    {
        cout<<"NGHE NHAC";
    }
    
}


int f1()
{
    a=getch();
        if(a==0||a==224)
        {
            a=500;
            b=getch();
        }
}
Goodday!

I tried to compile your code, but i think that on line 46 you need the lowercase
z() instead of the uppercase Z().

I am a complete noob but vs gives also a error because of getch().
It says it needs to be _getch(). But i think that the int function z, regis, login
and f1 also needs to return a int value. but it never does.

I hope this helps.
Yes. Either declare the function as returning an int, and do actually return an integer value, or declare the function as void.

Also, turn on as many compiler warnings as possible - they are there to help detect possible problems.
In g++ I have options
-std=c++11 -Wextra -Wall -pedantic-errors
Topic archived. No new replies allowed.