-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmy_graph.c
46 lines (33 loc) · 1.01 KB
/
my_graph.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "my_mat.h"
#include <stdio.h>
#include <stdbool.h>
#define SIZE 10
int main() {
int mat[SIZE][SIZE]; // assigning memory for the matrix
char option; // assigning memory for the chosen option
int i, j; // declare i and j once at the beginning
while (true) {
scanf(" %c", &option);
switch (option) {
case 'A':
inputMat(mat);
break;
case 'B':
scanf("%d", &i);
scanf("%d", &j);
checkRoute(i, j, mat);
break;
case 'C':
scanf("%d", &i);
scanf("%d", &j);
int sp = shortestPath(i, j, mat);
printf("%d\n", sp); // No space after 'C' result
break;
case 'D':
return 0;
default:
printf("Invalid option\n");
}
}
return 0; // Added a return statement at the end of main
}