Pascal/Turbo Pascal - Error de compilacion en un programa

 
Vista:

Error de compilacion en un programa

Publicado por Tomás (1 intervención) el 10/11/2015 22:41:36
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
92
93
94
95
96
97
program Project1;
uses crt;
type
 
  lista_usuario=^nodo_usuario;
  usuario=record
    nombre:string[30];
    password:string[30];
    end;
  nodo_usuario=record
    psig_usuario:lista_usuario;
    dato_usuario:usuario;
  end;
 
 
var
   rta_usuario:integer;
   rta:char;
  nuevo_usuario:usuario;
  l_u:lista_usuario;
  aux_login:usuario;
    procedure agregar_usuario(var l_u:lista_usuario;nuevo_usuario:usuario);
var
nuevo:lista_usuario;
begin
new(nuevo);
nuevo^.dato_usuario.nombre:=nuevo_usuario.nombre;
nuevo^.dato_usuario.password:=nuevo_usuario.password;
nuevo^.psig_usuario:=l_u;
l_u:=nuevo;
end;
function busca_usuario(l_u:lista_usuario;nuevo_usuario:usuario):usuario;
var
aux:lista_usuario;
aux2:usuario;
begin
     aux:=l_u;
     while(aux<>nil)and(aux^.dato_usuario.nombre<>nuevo_usuario.nombre)and(aux^.dato_usuario.password<>nuevo_usuario.password)  do
     begin
     aux:=aux^.psig_usuario;
     end;
     if (aux=nil)then
        begin
        writeln('No existe');
        aux2.nombre:='nnn';
        busca_usuario:=aux2;
        end
        else
        begin
        busca_usuario:=aux^.dato_usuario;
        end;
end;
procedure login;
begin
       writeln('  1.  INGRESAR    ');
       writeln('  2.  REGISTRARSE ');
    readln(rta_usuario);
     CASE(rta_usuario) OF
     1:
         begin
        writeln('Ingrese usuario');
        readln(nuevo_usuario.nombre);
        writeln('Ingrese contraseña');
        readln(nuevo_usuario.password);
        aux_login:=busca_usuario(l_u,nuevo_usuario);
        if(aux_login<>'nnn') then
         menu_principal;
         end;
 
    2:
        begin
        writeln('Ingrese usuario');
        readln(nuevo_usuario.nombre);
        writeln('Ingrese contraseña');
        readln(nuevo_usuario.password);
        aux_login:=busca_usuario(l_u,nuevo_usuario);
        if(aux_login='nnn') then
         agregar_usuario(l_u,nuevo_usuario)
         else
          writeln('Usuario ya existente,ingrese uno nuevo o presione S para salir');
          readln(rta);
          if(rta='s') then
           exit
           else
             writeln('Ingrese usuario');
             readln(nuevo_usuario.nombre);
             writeln('Ingrese contraseña');
             readln(nuevo_usuario.password);
             busca_usuario(l_u,nuevo_usuario);
 
 
end;
end;
end;
     begin
  l_u:=nil;
  end.


No puedo hacer que compile, la idea seria que el usuario tenga un menú de login para entrar al menu principal,tira los siguientes errores
Disculpen el desorden el código, desde ya, gracias.
Uso lazarus.
1
2
3
Compilar proyecto, Objetivo: project1.exe: Código de salida 1, Errores: 3
project1.lpr(66,21) Error: Operator is not overloaded: "usuario" = "Constant String"
project1.lpr(77,21) Error: Operator is not overloaded: "usuario" = "Constant String"
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

Error de compilacion en un programa

Publicado por ramon (2158 intervenciones) el 13/11/2015 16:21:51
Pascal no admite registos en retorno de funciones function busca_usuario(l_u:lista_usuario;nuevo_usuario:usuario):usuario;
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

Error de compilacion en un programa

Publicado por ramon (2158 intervenciones) el 17/11/2015 17:41:19
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
program Project1;
 uses
   crt;
 type
  string30 = string[30];
  lista_usuario = ^nodo_usuario;
   usuario = record
        nombre : string30;
      password : string30;
     end;
 
  nodo_usuario = record
    psig_usuario : lista_usuario;
    dato_usuario : usuario;
  end;
 
 
var
  rta_usuario : integer;
  rta : char;
  nuevo_usuario : usuario;
  anter, actual, ultim, primer : lista_usuario;
  aux_login : usuario;
 
  procedure agregar_usuario(usuar : usuario);
  begin
      if primer = nil then
      begin
        new(actual);
        actual^.dato_usuario := usuar;
        primer := actual;
        actual^.psig_usuario := nil;
      end
   else
      begin
          anter := actual;
          new(actual);
          actual^.dato_usuario := usuar;
          anter^.psig_usuario := actual;
          actual^.psig_usuario := nil;
      end;
   end;
 
   function pasa_a_mayusculas(d : string30) : string30;
   var
     i : integer;
     begin
        for i := 1 to length(d) do
        d[i] := upcase(d[i]);
        pasa_a_mayusculas := copy(d,1,length(d));
     end;
 
   function busca_usuario(var log : usuario;pasw : string30) : boolean;
   var
    aux : lista_usuario;
    encont : boolean;
    begin
     pasw := pasa_a_mayusculas(pasw);
     encont := false;
     aux := primer;
     while aux <> nil do
     begin
        if pasa_a_mayusculas(aux^.dato_usuario.password) = pasw then
        begin
          log := aux^.dato_usuario;
          encont := true;
          break;
        end;
        aux := aux^.psig_usuario;
     end;
     busca_usuario := encont;
  end;
 
  procedure muestra_registros;
  var
    tempo : lista_usuario;
    p : integer;
  begin
     if primer <> nil then
     begin
        clrscr;
        tempo := primer;
        writeln('   NOMBRE                        PASSWORD');
        p := 1;
        while tempo <> nil do
        begin
           gotoxy(4,1 + p);write(tempo^.dato_usuario.nombre);
           gotoxy(34,1 + p);write(tempo^.dato_usuario.password);
           tempo := tempo^.psig_usuario;
           p := p + 1;
        end;
        gotoxy(4,3 + p);write('Pulse Una Tecla');
        readkey;
     end
  else
     begin
        writeln('    Registros Vacios Pulse Una Tecla');
        readkey;
     end;
  end;
 
   procedure menu;
   var
     sal : boolean;
   begin
      sal := false;
      repeat
       clrscr;
       writeln('<<< Menu Jeneral >>>');
       writeln;
       writeln('    1.  INGRESAR    ');
       writeln('    2.  REGISTRARSE ');
       writeln('    3.  VER REGISTROS');
       writeln('    4.  SALIR');
       writeln;
       write('  **  Opcion ** : ');
       readln(rta_usuario);
       if rta_usuario in[1,2,3,4] then
       begin
       clrscr;
     CASE rta_usuario OF
     1 : begin
           writeln('    **** Ingresar Usuario ****');
           writeln;
           write('       Ingrese usuario : ');
           readln(nuevo_usuario.nombre);
           write('    Ingrese contrase¤a : ');
           readln(nuevo_usuario.password);
           writeln;
           if busca_usuario(aux_login,nuevo_usuario.password) = true then
           begin
              writeln('   *** El Usuario Entrado Existe ***');
              writeln;
              writeln('   <<< Pulse Una Tecla >>>');
              readkey;
           end
        else
           begin
              agregar_usuario(nuevo_usuario);
              writeln('   *** El Usuario Se Ingreso Correcta Mente ***');
              writeln;
              writeln('   <<< Pulse Una Tecla >>>');
              readkey;
         end;
      end;
    2:
        begin
            writeln('    **** Registro de Usuario ****');
            writeln;
            write('       Ingrese usuario : ');
            readln(nuevo_usuario.nombre);
            write('    Ingrese contrase¤a : ');
            readln(nuevo_usuario.password);
            writeln;
            if busca_usuario(aux_login,nuevo_usuario.password) = true then
           begin
              writeln('   /// Usuario ya existente,ingrese uno nuevo \\\');
              writeln;
              writeln('    Pulse Una Tecla ');
              readkey;
           end
      else
        begin
           agregar_usuario(nuevo_usuario);
           writeln('   *** El Usuario Se Ingreso Correcta Mente ***');
           writeln;
           writeln('   <<< Pulse Una Tecla >>>');
           readkey;
        end;
      end;
   3 : begin
          muestra_registros;
       end;
   4 : sal := true;
    end;
   end;
     until sal = true;
  end;
 
     begin
      primer := nil;
      menu;
     end.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar