compiler error

i was witing this code in c++ using the compiler "code blocks'. there were many errors which i managed to eliminate but didn't have my luck with this one . here's the code.
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
  #include<iostream>
#include<string.h>
#include<fstream>
using namespace std;
char enpass[10];
char depass[10];
char pass;
int i;
fstream file("userpass.txt",ios::in | ios::out);
char encryptpass(pass)
{
for(i=0; pass[i] != '\0'; ++i )
    {
        enpass[i]= ++pass[i];
    return(enpass)
    }

}
char decryptpass(str)
{
    for( ; str!='\0'; ++str )
{
    depass[i]= --str;
    return(depass)
}
}
int main()
{
    int flag=0;

    if(flag=0)
    {
        cout<<"enter your password";
        char pass[10];
        cin>>pass;
        file<<enpass[10];
    }
  else
  {
      cout<<"enter password";
      cin>>pass;
       bool check=false;
       static char str[10];
       file.seekg(ios::beg);
       file >> str;
       file.close();
       decryptpass(str);
       if(pass=depass)
       {
           check=true;
       }
  }
return(0);
}

the compiler is throwing this error--
expected ',' or ';' before the '{' token on line 11.
You need to provide a type for the parameter: char encryptpass(char pass[])

You will get more errrors as soon as you fixed this one. Line 15/24: The return is within the loop and has the wrong type.
Why are you using the <string.h> C library? Since you are programming in C++ you should use the standard <string> library. It is more safer to use, too.
Last edited on
Topic archived. No new replies allowed.