/ SeriousOJ /

Record Detail

Compile Error

foo.c: In function 'main':
foo.c:37:19: error: expected '(' before '{' token
   37 |                 if{
      |                   ^
      |                   (

Code

#include<stdio.h>
#include<string.h>
#include<stdlib.h>

#define MAX_NAME_LEN 21
#define MAX_GUESTS 100

typedef struct{
    char name[MAX_NAME_LEN];
    int entered;
} Guest;

Guest guest_list[MAX_GUESTS];
int num_guests;

int main(){
    scanf("%d",&num_guests);
    for(int i=0; i<num_guests; i++){
        scanf("%s", guest_list[i].name);
        guest_list[i].entered=0;
    }

    int num_arrivals;
    scanf("%d",&num_arrivals);
    char arrival_name[MAX_NAME_LEN];
    for(int i=0; i<num_arrivals; i++){
        scanf("%s", arrival_name);
        int found=0;
        for (int j=0; j<num_guests; j++){
            if(strcmp(arrival_name,guest_list[j].name)==0){
                found=1;
                if(guest_list[j].entered==0){
                    printf("welcome!\n");
                    guest_list[j].entered=1;

                }
                if{
                    printf("Already inside!\n");
                }
                break;
            }

        }
        if(!found){
            printf("sorry,not on the list\n");
        }
    }
        return 0;

}

Information

Submit By
Type
Submission
Problem
P1227 LUCC Party Check-in
Contest
LUCC Presents Intra LU Junior Programming Contest - Replay
Language
C99 (GCC 13.2.0)
Submit At
2025-09-02 16:14:23
Judged At
2025-09-02 16:14:23
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes