Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
ilahma
/
iax0583
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
aeef1f62
authored
6 years ago
by
ilahma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
82240b0b
master
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
0 deletions
Lab11/labtask2.c
Lab11/labtask2.c
0 → 100644
View file @
aeef1f62
#include <stdio.h>
#include <string.h>
void
readdata
(
char
name
[
6
][
20
],
char
password
[
6
][
20
],
char
status
[
6
][
20
],
char
balance
[
6
][
20
]);
int
nameValidate
(
char
name
[
20
],
char
names
[
6
][
20
]);
int
passwordValidate
(
char
password
[
20
],
char
password
[
6
][
20
])
int
main
()
{
char
names
[
6
][
20
];
char
name
[
15
];
char
passwords
[
6
][
20
];
char
password
[
15
];
char
account_statuses
[
6
][
20
];
char
account_balances
[
6
][
20
];
int
index
;
readdata
(
names
,
passwords
,
account_statuses
,
account_balances
);
do
{
printf
(
"Enter name and password"
);
scanf
(
"%s"
,
name
);
scanf
(
"%s"
,
password
);
index
=
nameValidate
(
name
,
names
);
}
while
(
index
<
0
);
printf
(
"%d"
,
index
);
return
0
;
}
void
readdata
(
char
name
[
6
][
20
],
char
password
[
6
][
20
],
char
status
[
6
][
20
],
char
balance
[
6
][
20
])
{
int
i
;
for
(
i
=
0
;
i
<
6
;
i
++
)
{
scanf
(
"%s%s%s%s"
,
name
[
i
],
password
[
i
],
status
[
i
],
balance
[
i
]);
}
}
int
nameValidate
(
char
name
[
20
],
char
names
[
6
][
20
])
{
int
i
;
for
(
i
=
0
;
i
<
6
;
i
++
)
{
if
(
strcmp
(
name
,
names
[
i
])
==
0
)
{
return
i
;
}
}
return
-
1
;
}
int
passwordValidate
(
char
password
[
20
],
char
password
[
6
][
20
])
{
int
i
;
for
(
i
=
0
;
i
<
6
;
i
++
)
{
if
(
strcmp
(
password
,
password
[
i
])
==
0
)
{
return
i
;
}
}
return
-
1
;
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment