یه سری از اشکالا رو رفع کردم، بقیش با خودت، من نفهمیدم چکار کردی
کد:
// MIG.cpp : Defines the entry point for the console application.
//
///////////////////////////Tarife Araye Haye 2Bodito doros kon; inja ha ke 1 gozashtamo taghir bede [][1]
#include "stdafx.h"
#include"conio.h"
#include<string>
#include<list>
#include <iostream>
using namespace std;
int n;
void costCalculate(int[][1], int [],int []);
int Check(int,int []);
int Count(int[][1]);
int count(int []);
int main ()
{
double *Cost;
int ** setMat;
int graphNumber,**adjMatrix;
string mystring ;
int c,sum,x,j=1,count=0,i,edge,k,l,z,p,element1,element2,n,a[100]={0};
///////////////گرفتن رشته از ورودی
cin>>mystring;
cout << mystring;
c=mystring.length();
cout<<c;
//////////////////تبدیل رشته ورودی به ارایه ای از اعداد
for(int i=0;i<c;i++)
{
if(mystring.at(i)!=',')
sum=0;
while(mystring.length()!=i && mystring.at(i)!=',')
{
x=mystring.at(i)-48;
sum=sum*10+x;
i++;
}
count++;
a[j++]=sum;
}
///////////////////
///////////////////ایجاد و گرفتن مقادیر ماتریس
cout<<"enter the number of node graph :";
cin>>graphNumber;
adjMatrix=new int*[graphNumber];
for(i=1;i<=graphNumber;i++)
adjMatrix[i]=new int[graphNumber];
for(i=1;i<=graphNumber;i++)
{
for(j=1;j<=graphNumber;j++)
{
if(i==j)adjMatrix[i][j]=0;
else
{
cout<<" If edge ("<<i<<","<<j<<")is in the graph, enter 1 else type 0:"<<"\n";
cin>>edge;
adjMatrix[i][j]=edge;
}//end else
}//end for
}
//////////////////
Cost= new double[count];//ارایه ای جهت نگه داری هزینه هر سطر از ماتریس
////////////////
setMat=new int*[count];
for( i=1;i<=count;i++)
setMat[i]=new int[graphNumber];
/////////////////ایجاد ارایۀ setMat
for(k=1;k<=count;k++)
{
z=2;
setMat[k][1]=a[k];
for(j=2;j<=graphNumber+1;j++)
{
l=j-1;
if(adjMatrix[a[k]][l]==1)
{setMat[k][j]=l;z++;}
}
}
/////////////////مقدار دهی ارایه Cost
for(int s=1;s<=count;s++)
{
costCalculate(&setMat[s][graphNumber],a,Cost(//////inja chizi nazashti///////////));
}
getch();
return 0;
}
//---------------------------
int Check(int A[][1],int a[])
{
int flag=0,mst=0;
////////////////////////////////////////////
/////////iرو تعریف نکردی!!!///////////////
////////////////////////////////////////////
int i = 0;////////////////ino khasti taghyir bede
for(int j=1;j<=n;j++)
{
for(int k=1;k<=count(a);k++)
{flag=0;
if(A[i][j]==a[k])
{
mst++;
flag=1;
}
if(flag==1)break;
}
}
return mst;
}
///-------
void costCalculate(int A[][1],int a[],int c[])
{
int element1,element2;
////////////////////////////////////////////
/////////iرو تعریف نکردی!!!///////////////
////////////////////////////////////////////
int i = 0;////////////////ino khasti taghyir bede
element1= Check(A[i][n],a);
element2=Count(A[i][n]);
c[i]=element1/element2;
}
///-------
int count(int x[])
{
int i=1,c=0;
while(x[i]!=0)
c++;
return c;
}
//-------
int Count(int A[][1])
{
int c=0;
////////////////////////////////////////////
/////////iرو تعریف نکردی!!!///////////////
////////////////////////////////////////////
int i = 0;////////////////ino khasti taghyir bede
for(int j=1;j<=n;j++)
{
if(A[i][j]!=0)
c++;
}
return c;
}