> For the complete documentation index, see [llms.txt](https://wenbo-notes.gitbook.io/coding/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wenbo-notes.gitbook.io/coding/kattis/easy/attendance.md).

# Attendance

## Question

{% embed url="<https://open.kattis.com/problems/attendance2>" %}

## Solution

### Idea

This question is an array manipulation problem. The idea is easy:

1. First Iteration is to mark the attendance: we start from the second entry and if encounter "Present!", mark the previous name as `present`.
2. Second Iteration is to print the absence: we start from the first entry and if the name is not "Present!" and its absence is false, print out the absent student's name.

But the implementation may depends individually. Personally, I used `struct` in C to solve it.&#x20;

{% code lineNumbers="true" %}

```c
typedef struct student {
  char *name;
  bool present;
} student;

```

{% endcode %}

### Code

{% @github-files/github-code-block url="<https://github.com/mendax1234/Coding-Problems/blob/main/kattis/attendance2/attendance2.c>" %}
