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
cee7589d
authored
Nov 24, 2018
by
ilahma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete homework2.c
parent
c0a1d3ef
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
96 deletions
homework2.c
homework2.c
deleted
100644 → 0
View file @
c0a1d3ef
#include <stdio.h>
#include <string.h>
void
readdata
(
char
name
[
15
][
15
],
float
points
[
15
],
int
n
);
void
printdata
(
char
name
[
15
][
15
],
float
points
[
15
],
int
n
);
void
comparedata
(
char
name
[
15
][
15
],
float
points
[
15
],
int
n
);
int
main
()
{
char
names
[
15
][
15
];
float
points
[
15
];
float
temp
;
int
n
;
int
i
;
int
j
;
printf
(
"Please enter the number of photographers ( The value should be less than 15)
\n
"
);
scanf
(
"%d"
,
&
n
);
while
(
n
<
0
||
n
>
15
)
{
printf
(
"PLEASE ADD NUMBER BETWEEN 1 AND 15
\n\n
"
);
scanf
(
"%d"
,
&
n
);
}
readdata
(
names
,
points
,
n
);
printdata
(
names
,
points
,
n
);
comparedata
(
names
,
points
,
n
);
printf
(
"Top 3:
\n
"
);
for
(
i
=
0
;
i
<
3
;
i
++
)
{
printf
(
"No%d: %s %.2f
\n
"
,
i
+
1
,
names
[
i
],
points
[
i
]);
}
if
(
points
[
i
]
==
0
)
{
printf
(
"Disqualified one(s): %s %.f
\n
"
,
names
[
i
],
points
[
i
]);
}
else
{
printf
(
"Disqualified: none"
);
}
return
0
;
}
void
readdata
(
char
name
[
15
][
15
],
float
points
[
15
],
int
n
)
{
int
i
;
for
(
i
=
0
;
i
<
n
;
i
++
)
{
scanf
(
"%s%f"
,
name
[
i
],
&
points
[
i
]);
}
}
void
printdata
(
char
name
[
15
][
15
],
float
points
[
15
],
int
n
)
{
int
i
;
for
(
i
=
0
;
i
<
n
;
i
++
)
{
printf
(
"%s
\t
"
,
name
[
i
]);
printf
(
"%.f
\n
"
,
points
[
i
]);
}
}
void
comparedata
(
char
name
[
15
][
15
],
float
points
[
15
],
int
n
)
{
int
i
;
int
j
;
float
temp
;
for
(
i
=
0
;
i
<
n
;
i
++
)
{
for
(
j
=
0
;
j
<
(
n
-
i
-
1
);
j
++
)
{
if
(
points
[
j
]
<
points
[
j
+
1
])
{
temp
=
points
[
j
];
points
[
j
]
=
points
[
j
+
1
];
points
[
j
+
1
]
=
temp
;
}
}
}
}
\ 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