Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- http://facebook.com/aminpropastebin
- #include <stdio.h>
- #include <string.h>
- #define numplace 3
- #define nop -1
- int main(){
- char places[numplace]={"Adam","Sofea","Raja"};
- int roads[numplace][numplace] = {{0,nop,2},{3,0,nop},{nop,5,0}};
- int from, to;
- char buff[10];
- printf("From: ");
- fgets(buff,9,stdin);
- for(from=;from<numplace;from++){
- if (strstr(places[from], buff))break;
- }
- printf("To: ");
- fgets(buff,9,stdin);
- for(to=0;to<numplace;to++){
- if (strstr(places[to],buff))break;
- }
- printf("From %s to %s: ", places[from], places[to])'
- if(roads[from][to] != nop){
- printf("It is %d KM", roads[from][to]);
- }
- else
- printf("There is no direct path);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement