i found this code in C++ but i can't convert it from C++ to C, help me please
i don't know C++.
#include <iostream>
#include<stack>
#include<stdio.h>
#include <string.h>
using namespace std;
#define MAX 10000
/*class node{
int */
unsigned int graph[MAX][MAX];// = { { 0, 1 },// 0 1 0
// { 1, 1 }};//2 0 0;
int nodes;
int fnodes;
int counter2;
stack<int> myStack;
int start;
int final[MAX];
int V, E;
int visit[MAX];
char states[5];
bool empty = true;
int read()
{
memset(states,0, sizeof(states));
cin >> nodes;
if(nodes == 0)
return 0;
cin >> fnodes;
int counter = 0;//Start states
counter2 = 0;
int cont;//String Length
for(int a=0; a<fnodes; a++)
{
cin >> states;
cont = -1;
for(int k=0; k<5; k++)
if(states[k] != '\0')
cont++;
else
break;
//cout << "cont -> " << cont;
//cout << *states;
// cout << states[0] << endl;
// cout << states[cont] << endl;
int aux = 0;//Sum of characters for Nodes
int aux2 = 0;//Sum of characters for Nodes
int mult = 1;//Multiple
if(states[cont]=='f')
{
for(int k=cont-1; k>=0; k--)
{
//cout << " -> " << states[k]<< endl;
aux+=((int)states[k]- 48)*mult;
//cout << " -> " << aux << endl;
mult*=10;
}
final[counter2++] = aux;
//cout << final[counter2-1] << endl;
}
else
{
if(counter++!=1)
{
for(int k=cont-1; k>=0; k--)
{
//cout << " -> " << states[k] << endl;
aux+=((int)states[k]-48)*mult;
mult*=10;
}
start = aux;
}
//cout << start << endl;
}
}
for(int a=0; a<nodes; a++)
{
for(int b=0; b<nodes; b++)
{
cin >> graph[a][b];
}
}
if(counter>1)
return -1;
return 1;
}
void calc()
{
for(int a=0;a<30;a++)
{
for(int b=0;b<30;b++)
{
if(a*b<100)
graph[a][b]=0;
else
graph[a][b]=1;
}
}
}
bool compareVertex(int v)
{
for(int k=0; k<counter2; k++)
if(final[k]==v)
{
//cout << " - >" << final[k] << " -> " << v << endl;
return true;
}
return false;
}
void dfs(int vertex)
{
//cout << vertex << " -> ";
if(compareVertex(vertex))
empty=false;
visit[vertex] = 1;
for (int i=0;i<nodes;i++)
if (!visit[i] && graph[vertex][i])
dfs(i);
}
void bfs(int s)
{
int i, j, node;
memset(visit, 0, sizeof(visit));
myStack.push(s);
while(!myStack.empty())
{
node = myStack.top();
myStack.pop();
if(visit[node]) continue;
visit[node] = 1;
for(i=0; i<V; i++)
if(graph[node][i]) myStack.push(i);
}
}
void print()
{
for(int a=0;a<nodes;a++)
{
for(int b=0;b<nodes;b++)
{
cout << graph[a][b] << " ";
}
cout << endl;
}
}
int main()
{
int j=0;
int locuas = 0;
//calc();
do
{
locuas = read();//Check integer
if(locuas == -1)
{
cout << "This is not an DFA" <<endl;
continue;
}
if(locuas == 0)
return 0;
//print();
for (int i=0;i<nodes;i++)
visit[i] = 0;
dfs(start);
if(empty)
cout << "The Automata Language is Empty" <<endl;
else
cout << "The Automata Language is not Empty" <<endl;
empty = true;
//bfs(0);
//cout << endl;
}while(true);
return 0;
}