1. ultra short mbti quiz (C) .*+

1. ultra short mbti quiz (C) .*+

·

4 min read

technically it’s not my first day with C, because I’ve taken a C programming course a month ago. But to be honest, it was a loop of generating the code with AI, then reading through it to “understand,” make some changes, and submitting. I think it’s the same with most programming beginner students. But now I want to change it, because who wants to submit codes, scared that I might be accused of using AI any day now?

It took me hours to figure out how to use VScode correctly. They kept showing an error message and did not display the updated version of the code. I asked my friends but they couldn’t identify the problem. But after the hours, I figured it out using Terminal. (Terminal is the only thing I can understand ;-; )

My Code 🦢🤍

What’s your MBTI? Mine is ESTJ. I thought I’d code something that actually interests me. ♪

anyways, below is the code I made. It’s an ultra short MBTI quiz. I had trouble figuring out the chars and ints and the %d, %s, %1s , like one letter mistake and I can’t run the code anymore. The questions were generated by ChatGPT , but the code was written by me. I think I did a good job as a noob. I was reopening other tabs so many times when I forgot how to code a specific thing, but once I write it down, it is pretty easy. One thing I think I can improve is the repetitive-ness. I feel like the code I wrote is the basic form, but with extra thinking, I would be able to shorten the code by a lot and still get the same result. My family all took the test and told me, “you need more questions these aren’t accurate.” Give me a break, it’s called ultra-short MBTI test for a reason. Maybe I should extend the 4 questions into at least 12 though 🥲

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

int main(){

    char M, B, T, I;
    char final[5];
    char yn;
    char charac[5];

    printf("welcome to the ultra-short MBTI quiz!\n");

    printf("Question 1: When you have free time, what sounds more fun?\n");
    printf("A. Staying at home and chilling. \n");
    printf("B. Going out and hanging out with friends. ");
    scanf(" %c", &M);

    printf("Question 2: WHen solving answers, you prefer: \n");
    printf("A. focusing on facts and what's practical\n");
    printf("B. being creative and focusing on possibilities\n");
    scanf(" %c", &B);

    printf("Question 3: When making decisions, you usually: \n");
    printf("A. stay logical and focus on fairness\n");
    printf("B. think about how everyone would feel\n");
    scanf(" %c", &T);

    printf("Question 4: when it comes to plans, you usually: \n");
    printf("A. Like clear schedules and sticking to them.\n");
    printf("B. Prefer to go with the flow and decide as you go.\n");
    scanf(" %c", &I);

    if (M == 'A' || M == 'a'){
        final[0] = 'I';
    } else if (M == 'B' || M=='b'){
        final[0] = 'E';
    }

    if (B == 'A' || B == 'a'){
        final[1] = 'S';
    } else if (B == 'B' || B=='b'){
        final[1] = 'N';

    }

    if (T == 'A' || T == 'a'){
        final[2] = 'T';
    } else if (T == 'B' || T=='b'){
        final[2] = 'F';

    }

    if (I == 'A' || I == 'a'){
        final[3] = 'J';
    } else if (I == 'B' || I=='b'){
        final[3] = 'P';

    }

    final[4] = '\0';

    printf("Your MBTI is: %s\n", final);
    printf("would you like to see which characters our MBTI matches? (y/n)");
    scanf(" %c", &yn);

    if (yn == 'N' || yn == 'n'){
        printf("thanks for using our quiz!");
        return 0;
    }else if (yn == 'Y' || yn=='y'){
        printf("write your mbti and we'll match you with a character: \n");
        scanf("%4s", charac);
    }

    if (strcmp(charac, "intj")==0 || strcmp(charac, "INTJ")==0){
        printf("you matched with Batman! 🦇");

    }else if (strcmp(charac, "INTP") ==0|| strcmp(charac,"intp") == 0){
        printf("you matched with Sherlock Holmes! 🕵️ ");

    }else if (strcmp(charac, "ENTJ") ==0|| strcmp(charac,"entj") == 0){
        printf("you matched with Lord Voldemort! 👃 ");

    }else if (strcmp(charac, "ENTP" )==0 || strcmp(charac,"entp") == 0){
        printf("you matched with Captain Jack Sparrow! 🏴‍☠️ ");

    }else if (strcmp(charac, "INFJ")==0 || strcmp(charac,"infj")==0){
        printf("you matched with Obi-Wan Kenobi! 💫 ");

    }else if (strcmp(charac, "INFP")==0 || strcmp(charac,"infp")==0){
        printf("you matched with Frodo Baggins! 🧝 ");

    }else if (strcmp(charac, "ENFJ")==0 || strcmp(charac,"enfj")==0){
        printf("you matched with Tanjiro Kamado! 🏯 ");

    }else if (strcmp(charac, "ENFP")==0 || strcmp(charac,"enfp")==0){
        printf("you matched with Harley Quinn! 🎪 ");

    }else if (strcmp(charac, "ISTJ")==0 || strcmp(charac,"istj")==0){
        printf("you matched with Hermoine Granger! 🧪 ");

    }else if (strcmp(charac, "ISFJ")==0 || strcmp(charac,"isfj")==0){
        printf("you matched with Captain America! 🇺🇸 ");

    }else if (strcmp(charac, "ESTJ")==0 || strcmp(charac,"estj")==0){
        printf("you matched with Maki Zenin! 👻 ");

    }else if (strcmp(charac, "ESFJ")==0 || strcmp(charac,"esfj")==0){
        printf("you matched with Troy Bolton! 🏀 ");

    }else if (strcmp(charac, "ISTP")==0 || strcmp(charac,"istp")==0){
        printf("you matched with Indiana Jones! 🤠 ");

    }else if (strcmp(charac,"ISFP")==0 || strcmp(charac,"isfp")==0){
        printf("you matched with Luke Skywalker! ✨ ");

    }else if (strcmp(charac, "ESTP")==0 || strcmp(charac,"estp")==0){
        printf("you matched with Buzz Lightyear! 🌟 ");

    }else if (strcmp(charac, "ESFP")==0|| strcmp(charac,"esfp")==0){
        printf("you matched with Seong Gi-hun! 🧇 ");


    }

    return 0;

}