How can I make this to continue until the user presses N? I've tried using while(1), while( option == 'y' || option == 'Y') but it kept giving an error for that, and if/else statements but no luck. So I decided to try a do while statement and same results, it seems it is working, but I don't know what I'm doing wrong. I even tried moving all the statements to different areas and still nothing.

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

enum meme {YEE, KNUCKLES, DOGE, HARAMBE, BUTKUS};

int dankestmemes(void); // function prototype

int main(void) {   

    srand(time(NULL)); // randomize random generator using current time
    enum meme dankMeme; // can contain YEE, WAE, DOGE, HARAMBE, or BUTKUS   
    int dank = dankestmemes(); // When program first executes
    char option;

do{

    switch(dank){

        case 0: // You will be put in the Yee dinosaur tribe
            dankMeme = YEE;  // Possibly the greatest meme in existance
            printf("Yee. Where the most obnoxious beings reside. Here you  \n"); // I recommend watching the YouTube video
            printf("well endure endless singing.\n"); // https://www.youtube.com/watch?v=q6EoRBvdVPQ
            break;        

        case 1: // You will be put in the Ugandan Knuckles tribe
            dankMeme = KNUCKLES; // #EBOLA
            printf("Ugandan Knuckles. Welcome my brutha, here you will find those \n");
            printf("who are adventurous. We strive to find our queen and da wae.\n"); 
            break;

        case 2: // u will b put in tribe of Doge
            dankMeme = DOGE;
            printf("DOGE. PPL IN THS TRIBE ARE MUCH WOW VERY AMAZE\n");
            break;

        case 3: // You will be put in the tribe of Harambe
            dankMeme = HARAMBE; // RIP in Peace sweet prince 
            printf("Harambe! Here you will feel the presence of his amazing grace. Only the wise and strong reside in this tribe. ");
            printf("No wonder why this tribe is everyone's favorite.\n");
            break;

        case 4: // You will be put in the tribe of Butkus
            dankMeme = BUTKUS; // WWBD
            printf("Butkus. This tribe is full of inconsequential people whos aura\n ");
            printf("affects those around them. You cannot escape the Butkus!\n");
            break;

         } // End of switch

         printf("Want to be resorted? Y/N: "); // asks if user wants to go again
        // option = getchar();
         scanf("%c", &option); // executes input
        if(option == 'y' || option == 'Y'){ // program will go again if yes is selected
            continue;
        }
        else{ // if no is selected program will break
            break;
        }
    }
    while (option != 'y' || option != 'Y');
                } // End of main

int dankestmemes(void){ //Starts when program is executed
    int memeInjections = rand() % 5; // Helps to randomize the outcome
    printf("You belong in the Tribe of "), memeInjections;
    return memeInjections;

 } // end of dankestmemes function

Output:

You belong in the Tribe of Ugandan Knuckles. Welcome my brutha, here you will find those
who are adventurous. We strive to find our queen and da wae.
Want to be resorted? Y/N: y
Ugandan Knuckles. Welcome my brutha, here you will find those
who are adventurous. We strive to find our queen and da wae.
Want to be resorted? Y/N:
root@fyve:~$

I think your problem is with

while (option != 'y' || option != 'Y');

In other words, keep processing the loop while the entered character is not y or not Y. You can see that if you enter y then the expression evaluates to

while (TRUE || FALSE);

and if you enter Y it becomes

while (FALSE || TRUE);

so in either case you end up with

while (TRUE);

Try using

while (option != 'y' &&  option != 'Y');

I just looked at the code and I just realized, that somehow I got to implement it inside the int dankestmemes(void) function or make a function prototype that allows you to play again but I'm not sure, because it doesn't seem to randomize at all, but I'll try what you said.

I edited my response a few times so make sure you look at it again to make sure you got the (hopefully) error-free version.

I did the
while(option != 'y' && option != 'Y');

thing and this is the output:

You belong to the tribe of Harambe! Here you will feel the presence of his amazing grace. Only the wise and strong reside in this tribe.
No wonder why this tribe is everyone's favorite.
Want to be resorted? Y/N: Y

and then it just goes back to bash from there. What confuses me is that it wants to work, but it isn't randomizing the outcomes :/

Try this, put line 13 int dank = dankestmemes(); after line 16 do{.

It gives me this:

warning: implicit declaration of function ‘dankestmemes’ [-Wimplicit-function-declaration]
     int dank = dankestmemes(); // When program first executes

A friend told me to do something like add the dank = dankestmemes() part after the if statement so it updates the variable when it loops around it'll produce a different result. But I'm still getting the same output.

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

enum meme {YEE, KNUCKLES, DOGE, HARAMBE, BUTKUS};

int dankestmemes(void); // function prototype

int main(void) {   

    srand(time(NULL)); // randomize random generator using current time
    enum meme dankMeme; // can contain YEE, WAE, DOGE, HARAMBE, or BUTKUS   
    int dank = dankestmemes(); // When program first executes
    char option;

    do{
        switch(dank){     
            case 0: // You will be put in the Yee dinosaur tribe
                dankMeme = YEE;  // Possibly the greatest meme in existance
                printf("You belong to the tribe of Yee. Where the most obnoxious beings reside. Here you  \n"); // I recommend watching the YouTube video
                printf("well endure endless singing.\n"); // https://www.youtube.com/watch?v=q6EoRBvdVPQ
                break;        

            case 1: // You will be put in the Ugandan Knuckles tribe
                dankMeme = KNUCKLES; // #EBOLA
                printf("You belong to the tribe of Ugandan Knuckles. Welcome my brutha, here you will find those \n");
                printf("who are adventurous. We strive to find our queen and da wae.\n"); 
                break;

            case 2: // u will b put in tribe of Doge
                dankMeme = DOGE;
                printf("U BELONG 2 THE TRIBE OF DOGE. MUCH WOW VERY AMAZE!!\n");
                break;

            case 3: // You will be put in the tribe of Harambe
                dankMeme = HARAMBE; // RIP in Peace sweet prince 
                printf("You belong to the tribe of Harambe! Here you will feel the presence of his amazing grace. Only the wise and strong reside in this tribe. \n");
                printf("No wonder why this tribe is everyone's favorite.\n");
                break;

            case 4: // You will be put in the tribe of Butkus
                dankMeme = BUTKUS; // WWBD
                printf("You belong to the tribe of Butkus. This tribe is full of inconsequential people whos aura\n ");
                printf("affects those around them. You cannot escape the Butkus!\n");
                break;
                        } // End of switch
      printf("Want to be resorted? Y/N: "); // asks if user wants to go again
      scanf("%c", &option); // executes input
        if(option == 'y' || option == 'Y'){ // program will go again if yes is selected
            continue;
        }
        //~ else{ // if no is selected program will break
            //~ break;
                             dank = dankestmemes();

    }

   while (option == 'y' || option == 'Y'); 

} // End of main

int dankestmemes(void){ //Starts when program is executed
    int memeInjections = rand() % 5; // Helps to randomize the outcome

    return memeInjections;

} // end of dankestmemes function

You have correctly been told twice by different people about moving the dank assignment to insode the loop, but you haven't moved it.

I don't know why you were getting the error. when I move line 13 like I said, it compiles just fine.

There is another problem however, you're not consuming the end of line character in your scanf or flushing the standard input. This creates problems when scanf runs again it reads the end of line character and the program ends. Something like this would work on Windows:

printf("Want go again? Y/N: "); // asks if user wants to go again
char temp = '\0';
scanf("%c%c", &option, &temp); // executes input

While looking at your program, it became obvious to me that using enum constants and hard coded descriptions, can be a maintenance nightmare down the road if you decide to add or remove a tribe. A struct with members name and description can be used in an array to simplify your code and be much easier to maintain:

#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#define NUMBER_OF_TRIBES 5
struct tribe
{
    char name[20];
    char description[200];
};
int dankestmemes(void); // function prototype
struct tribe tribes[NUMBER_OF_TRIBES];
int main(void) {
    srand(time(NULL)); // randomize random generator using current time
    tribes[0] = (struct tribe) 
    { 
        .name = "YEE", 
        .description = "You belong to the tribe of Yee. Where the most obnoxious beings reside. Here you  \nwill endure endless singing.\n" 
    };
    tribes[1] = (struct tribe)
    { 
        .name = "KNUCKLES", 
        .description = "You belong to the tribe of Ugandan Knuckles. Welcome my brutha, here you will find those \nwho are adventurous. We strive to find our queen and da wae.\n" 
    };
    tribes[2] = (struct tribe) 
    {
        .name = "DOGE",
        .description = "U BELONG 2 THE TRIBE OF DOGE. MUCH WOW VERY AMAZE!!\n" 
    };
    tribes[3] = (struct tribe) 
    { 
        .name = "HARAMBE", 
        .description = "You belong to the tribe of Harambe! Here you will feel the presence of his amazing grace. Only the wise and strong reside in this tribe. \nNo wonder why this tribe is everyone's favorite.\n" 
    };
    tribes[4] = (struct tribe) 
    { 
        .name = "BUTKUS", 
        .description = "You belong to the tribe of Butkus. This tribe is full of inconsequential people whos aura\naffects those around them. You cannot escape the Butkus!\n" 
    };
    char option;
    struct tribe dankmeme;
    do {
        int dank = dankestmemes();
        dankmeme = tribes[dank];
        printf("%s", dankmeme.description);
        printf("Want go again? Y/N: "); // asks if user wants to go again
        char temp = '\0';
        scanf("%c%c", &option, &temp); // executes input        
    } while (option == 'y' || option == 'Y');
} // End of main
int dankestmemes(void) { //Starts when program is executed
    int memeInjections = rand() % 5; // Helps to randomize the outcome
    return memeInjections;
}

The problem with the execution of dank = dankestmemes(); at line 54 is that it is only executed if option is not Y/y. The continue at line 50 when option = Y/y sends the program to check the while condition at line 58, bypassing line 54.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.