问题描述
这可能是一个非常像初学者的问题。
但是,我有一个处理图形的算法,而我目前拥有的只是预先输入的值。我想让它使用户能够输入图形的边缘,并且将用值填充多维数组。
这里有一些代码
#include <stdbool.h>
#include <stdio.h>
#include <iostream>
using namespace std;
#define vertex_count 4
int main()
{
// int vertex_count;
bool graph[vertex_count][vertex_count] =
{
{ 0,1,1 },{ 1,0 },};
int used_colors = 3;
graphColor(graph,used_colors);
return 0;
}
我假设我必须要求用户输入有多少个顶点和边,当用户输入边时,我会将它们一一放入数组中。
然而,我遇到了一个问题,当顶点计数没有定义但输入时,函数说它没有声明,等等。
有没有人知道这样做的最佳方法?
先谢谢你!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)