Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
tanton
/
programmeerimine_1
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
c2360412
authored
Sep 09, 2020
by
tonis2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
3ea936e1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
panga_automaat/automaat
panga_automaat/automaat.c
panga_automaat/automaat
View file @
c2360412
No preview for this file type
panga_automaat/automaat.c
View file @
c2360412
...
...
@@ -3,6 +3,12 @@
#define SUMMA 100
int
is_correct_choice
(
char
user_answer
[
3
])
{
char
new
[
3
];
strcpy
(
new
,
user_answer
);
return
(
strcmp
(
new
,
"no"
)
==
0
)
||
(
strcmp
(
new
,
"yes"
)
==
0
);
}
int
main
(
void
)
{
...
...
@@ -11,10 +17,20 @@ int main(void)
printf
(
"Kas soovite väikseid kupüüre? ( yes / no )
\n
"
);
scanf
(
"%s"
,
user_answer
);
while
(
!
strcmp
(
user_answer
,
"no"
)
==
0
||
!
strcmp
(
user_answer
,
"yes"
)
==
0
)
{
printf
(
"Kas soovite väikseid kupüüre? ( yes / no )
\n
"
);
scanf
(
"%s"
,
user_answer
);
int
user_choice
=
is_correct_choice
(
user_answer
);
printf
(
"Vastus %d
\n
"
,
user_choice
);
// while (*is_correct_choice != 1) {
// printf("Kas soovite väikseid kupüüre? ( yes / no ) \n");
// scanf("%s", user_answer);
// user_choice = is_correct_choice(user_answer);
// }
if
(
is_correct_choice
==
0
)
{
printf
(
"Vastus %s
\n
"
,
is_correct_choice
);
}
// printf("Vastus %s \n", user_answer);
return
0
;
}
\ No newline at end of file
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