i have coursework and i wrote the program but its not working ! can you help me about this

Assignment

Write a program for

-Creating a graph withnverticles andmedges.

-Counting the all isolated verticles in the graph

The Values ofnandmare set by user.

The result should be shown appropriately on the screen of the computer.

And My Codes

Code:// silinecek void edge_add code error #include <iostream.h> #include <stdlib.h> const int v_n=10; int i; struct dgraph{ char vertex; dgraph *gec; }*gr[v_n]; int vertex_check(dgraph *gr[v_n], char ver){ i=0; while(gr[i]){ if(gr[i]->vertex==ver) return 1; i++; } return 0; } void vertex_add(dgraph *gr[v_n], char ver){ if(vertex_check(gr,ver)==0){ int y=0; while(gr[y] && (y<v_n)) y++; gr[y]=new dgraph; gr[y]->vertex=ver; gr[y]->gec=NULL; cout << "\nVertex " << ver << " added.\n"; } else cout << "\nError."; } bool edge_check(dgraph *gr[v_n], char ch1, char ch2){ if((vertex_check(gr, ch1) && vertex_check(gr, ch2))==1){ int say=0; while(gr[say]->vertex!=ch1) say++; dgraph *point=gr[say]; while(point->vertex!=ch2 && point->gec!=NULL){ point=point->gec; if(point->vertex==ch2) return true; } } return false; } void edge_add(dgraph *gr[v_n], char ch1, char ch2){ if(edge_check(gr,ch1,ch2)==true) cout << "\nEdge exists."; else{ if(vertex_check(gr,ch1)==0) vertex_add(gr,ch1); if(vertex_check(gr,ch2)==0) vertex_add(gr,ch2); dgraph *p; int gez=0; while(gr[gez]->vertex!=ch1) gez++; p=new dgraph; p->vertex=ch2; p->gec=gr[gez]->gec; gr[gez]->gec=p; cout << "\n\nEdge added: " << ch1 << "->" << ch2 << "\n"; } } void yunus(){ int a=0; while(gr[a]!=NULL){ cout << "\n1\n"; a++; } } void main(){ int choice,vertices,edges,fa; int sayac=0; char vertex_name,edge_name1,edge_name2; cout << "Number of vertices:"; cin >> vertices; cout << "\nNumber of edges:"; cin >> edges; do{ do{ cout << " \n\n[MENU]\n"; cout << "1-> Add vertex\n"; cout << "2-> Add edge between Vertex 1 & Vertex 2\n"; //cout << "3-> List vertices with 3 out-degrees\n"; cout << "4-> Exit\n"; cout << " Choice:"; cin >> choice; } while(choice<1 && choice>4); switch(choice){ case 1: for(fa=0;fa<vertices;fa++){ cout << "\nVertex:"; cin >> vertex_name; vertex_add(gr,vertex_name); } break; case 2: for(fa=0;fa<edges;fa++){ cout << "\nVertex 1:"; cin >> edge_name1; cout << "Vertex 2:"; cin >> edge_name2; while(gr[sayac]->vertex!=edge_name1) sayac++; edge_add(&gr[sayac],edge_name1,edge_name2); sayac=0; } break; /*case 3: yunus(); break;*/ case 4: exit(1); } } while(choice!=4); }