diff --git a/Beginner/Travelling-sales-man.cpp b/Beginner/Travelling-sales-man.cpp new file mode 100644 index 00000000..85e8fe96 --- /dev/null +++ b/Beginner/Travelling-sales-man.cpp @@ -0,0 +1,90 @@ +#include + +using namespace std; + +int ary[10][10],completed[10],n,cost=0; + +void takeInput() +{ + int i,j; + + cout<<"Enter the number of villages: "; + cin>>n; + + cout<<"\nEnter the Cost Matrix\n"; + + for(i=0;i < n;i++) + { + cout<<"\nEnter Elements of Row: "<>ary[i][j]; + + completed[i]=0; + } + + cout<<"\n\nThe cost list is:"; + + for( i=0;i < n;i++) + { + cout<<"\n"; + + for(j=0;j < n;j++) + cout<<"\t"<"; + ncity=least(city); + + if(ncity==999) + { + ncity=0; + cout<