/********************************************************/ /* Title: Expert system based on House S01E01 */ /* Developer: Damian Gordon */ /* Date Created: 01/11/2024 */ /********************************************************/ /* Description: This is an Expert system to do a */ /* diagnosis based on House S01E01 */ /********************************************************/ /* Modified by: Developer, Date, Description */ /* Modified by: Developer, Date, Description */ /* Modified by: Developer, Date, Description */ /* Modified by: Developer, Date, Description */ /********************************************************/ #include int main() { /****************************************/ /* VARIABLES */ /****************************************/ /* Declare the variables to record the users' answers */ char MRI_YN, Thiamine_YN, CAT_Scan_YN; /****************************************/ /* GET USER ANSWERS */ /****************************************/ printf("************************************************\n"); printf("* Welcome to the HOUSE, S01E01 Expert System *\n"); printf("************************************************\n"); /* Check if the MRI showed anything */ printf("Was there anything on the MRI (y/n): "); scanf(" %c", &MRI_YN); /* Check if the Thiamine Level is elevated */ printf("Is the Thiamine Level elevated (y/n): "); scanf(" %c", &Thiamine_YN); /* Check if the CAT Scan showed anything */ printf("Was there anything on the CAT scan (y/n): "); scanf(" %c", &CAT_Scan_YN); /****************************************/ /* EXPERT SYSTEM */ /****************************************/ if ((MRI_YN == 'n') && (Thiamine_YN == 'n') && (CAT_Scan_YN == 'n')) { printf("==================================\n"); printf("POSSIBLE DIAGNOSIS: Brain tumour.\n"); printf("FOLLOW-UP TEST: Do a Contrast MRI.\n"); } else if ((MRI_YN == 'n') && (Thiamine_YN == 'n') && (CAT_Scan_YN == 'y')) { printf("==================================\n"); printf("POSSIBLE DIAGNOSIS: Brain lesion.\n"); printf("FOLLOW-UP TEST: Inject gadolinium.\n"); } else if ((MRI_YN == 'n') && (Thiamine_YN == 'y') && (CAT_Scan_YN == 'n')) { printf("==================================\n"); printf("POSSIBLE DIAGNOSIS: Brain aneurysm.\n"); printf("FOLLOW-UP TEST: Check protein markers.\n"); } else if ((MRI_YN == 'n') && (Thiamine_YN == 'y') && (CAT_Scan_YN == 'y')) { printf("==================================\n"); printf("POSSIBLE DIAGNOSIS: Stroke.\n"); printf("FOLLOW-UP TEST: Check SED rate.\n"); } else if ((MRI_YN == 'y') && (Thiamine_YN == 'n') && (CAT_Scan_YN == 'n')) { printf("==================================\n"); printf("POSSIBLE DIAGNOSIS: Ischemic syndrome.\n"); printf("FOLLOW-UP TEST: Give blood thinners.\n"); } else if ((MRI_YN == 'y') && (Thiamine_YN == 'n') && (CAT_Scan_YN == 'y')) { printf("==================================\n"); printf("POSSIBLE DIAGNOSIS: Creutzfeldt–Jakob disease.\n"); printf("FOLLOW-UP TEST: Test with interferon.\n"); } else if ((MRI_YN == 'y') && (Thiamine_YN == 'y') && (CAT_Scan_YN == 'n')) { printf("==================================\n"); printf("POSSIBLE DIAGNOSIS: Wernicke encephalopathy.\n"); printf("FOLLOW-UP TEST: Change diet.\n"); } else if ((MRI_YN == 'y') && (Thiamine_YN == 'y') && (CAT_Scan_YN == 'y')) { printf("==================================\n"); printf("POSSIBLE DIAGNOSIS: Cerebral vasculitus.\n"); printf("FOLLOW-UP TEST: Use immunosuppressant drugs.\n"); } else { printf("Error: Invalid input.\n"); } //Endif; return 0; } //End.