Hey, I seem to have a few problems
1. I want to use Records ex.
[code]User=Record
Username: string;
Password: string;[/code]
Now if I want to compare one of those with a string it doesnt work ex.
[code]User.Username = TEMP[/code]
it will give me an error ''Operator is not overloaded''
Why can't it compare the two variables?
2. How can I write an array into a string or read out an array to compare the single cells with a variable? Like the cell 1 of the array is equal to a sring? Here an example that I made that doesnt work [code]Example[1] = TEMP[/code] if I try that it will not work because it says cant read or write from this type of Variable
Can somebody help me there? Thx a lot in Advance
Comments
[code]program User_Registration;
uses
Crt;
Type
Userrecord= Record
Password: string;
Username: string;
Password_ID: integer;
Username_ID: integer;
end;
Var
Index: integer;
Temp: string;
I: integer;
n: integer;
Database: array [0..100] of string;
User: Userrecord;
Begin
Index:=0;
randomize;
writeln('User Registration Area');
writeln('');
writeln('');
{Eingabe des Usernamen}
write('Username: ');
readln(Userrecord.Username);
{
:
: [code]: program User_Registration;
:
: uses
: Crt;
:
: Type
: Userrecord= Record
: Password: string;
: Username: string;
: Password_ID: integer;
: Username_ID: integer;
: end;
:
: Var
:
: Index: integer;
: Temp: string;
: I: integer;
: n: integer;
: Database: array [0..100] of string;
: [red]User: Userrecord;[/red]
:
:
: Begin
:
:
:
: Index:=0;
: randomize;
: writeln('User Registration Area');
: writeln('');
: writeln('');
: {Eingabe des Usernamen}
: write('Username: ');
: [red]readln(Userrecord.Username);[/red]
[red]{
[b]Userrecord[/b] is a type, not a variable.
Use [b]User[/b] instead of [b]Userrecord[/b]
}[/red]
: {
:
: [code]: program User_Registration;
:
: uses
: Crt;
:
: Type
: Userrecord= Record
: Password: string;
: Username: string;
: Password_ID: integer;
: Username_ID: integer;
: end;
:
: Var
:
: Index: integer;
: Temp: string;
: I: integer;
: n: integer;
: Database: array [0..100] of string;
: [color=Red]User: Userrecord;[/color]
:
:
: Begin
:
:
:
: Index:=0;
: randomize;
: writeln('User Registration Area');
: writeln('');
: writeln('');
: {Eingabe des Usernamen}
: write('Username: ');
: [color=Red]readln(Userrecord.Username);[/color]
: {
[code]
program User_Registration;
uses
Crt;
Type
Userrecord = Record
Password : string;
Username : string;
Password_ID : integer;
Username_ID : integer;
end;
Var
Index : integer;
Temp : string;
I : integer;
n : integer;
Database : array [0..100] of string;
User : Userrecord;
Begin
Index:=0;
randomize;
writeln('User Registration Area');
writeln('');
writeln('');
{ Eingabe des Usernamen }
write('Username: ');
readln(User.Username);
{
I used Lazarus IDE which uses FreePascal
Now I use Turbo Pascal 7.0 and it works, how is that possible, does the FreePascal use a different Implementation? Oo
: Now I use Turbo Pascal 7.0 and it works, how is that possible, does
: the FreePascal use a different Implementation? Oo
:
FP has multiple modes, by default is not TP7 or Delphi compatible, so a program written in these dialects will not necessarily compile, unless you use the [b]{$mode ...}[/b] directive ( for TP7 use {$mode tp} ) to change the compatibility of the compiler. Read FP's documentation for more info, is well written and quite extensive.
I always deleted those informations ^^ Guess that must be the reason, thx for the great help