samedi 9 janvier 2021

Is there any way I can print NOT FOUND if the program can't find it?

This is my code (Note that I'm on linux) :

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

int main(){
    system("clear");
    char command[300];
start:
    printf("user@clo2>>");
    gets(command);
    if (strcmp(command,"exit")==0){
        system("clear");
        exit(1);
    }
    if (strcmp(command,"--version")==0){
        printf("CLO2 Version : 1.0");
        printf("\n");
        goto start;
    }

    return 0;
}

If the user enters a text that the program can't find then I want it to print the text "NOT FOUND".

Aucun commentaire:

Enregistrer un commentaire