c++中的cin怎么转换成C语言的代码?
voidcreateMGraph(MGraph*G){inti=0,j=0,k=0,w=0;cout<<"请输入定点数和边数:";cin>>G->numVertexes>...
void createMGraph(MGraph* G)
{
int i = 0, j = 0, k = 0, w = 0;
cout << "请输入定点数和边数: ";
cin >> G->numVertexes >> G->numEdges;
cout << "请输入图的节点" << endl;
for(i = 0; i < G->numVertexes; i++)
{
cin >> G->vexs[i];
}
for(i = 0; i < G->numVertexes; i++)
{
for(j = 0; j < G->numVertexes; j++)
{
G->arc[i][j] = INFINITY;
}
}
for(k = 0; k < G->numEdges; k++)
{
cout << "输入边(vi,vj)上的下标,i,j和权值w" << endl;
cin >> i >> j >> w;
G->arc[i][j] = w;
G->arc[j][i] = w;
}
}
int visited[MAXVEX] = {0};
怎么把这段代码改成C语言的啊?求大神教教我! 展开
{
int i = 0, j = 0, k = 0, w = 0;
cout << "请输入定点数和边数: ";
cin >> G->numVertexes >> G->numEdges;
cout << "请输入图的节点" << endl;
for(i = 0; i < G->numVertexes; i++)
{
cin >> G->vexs[i];
}
for(i = 0; i < G->numVertexes; i++)
{
for(j = 0; j < G->numVertexes; j++)
{
G->arc[i][j] = INFINITY;
}
}
for(k = 0; k < G->numEdges; k++)
{
cout << "输入边(vi,vj)上的下标,i,j和权值w" << endl;
cin >> i >> j >> w;
G->arc[i][j] = w;
G->arc[j][i] = w;
}
}
int visited[MAXVEX] = {0};
怎么把这段代码改成C语言的啊?求大神教教我! 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询