A Example for DLLs
This commit is contained in:
21
DynamicLinkLibrary/my_str-dll/main.c
Normal file
21
DynamicLinkLibrary/my_str-dll/main.c
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "my_str.h"
|
||||
#define MAX 100
|
||||
|
||||
int main() {
|
||||
char expression[MAX];
|
||||
printf("Enter an infix expression (e.g., (10+2)*3-4/2): ");
|
||||
fflush(stdout);//Important: To flush stdout buffer
|
||||
|
||||
if (fgets(expression, MAX, stdin)) {
|
||||
// Remove trailing newline character
|
||||
expression[strcspn(expression, "\n")] = 0;
|
||||
|
||||
double result = evaluate(expression);
|
||||
printf("Result: %.2f\n", result);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user