Computer Science > STUDY GUIDE > dgraph.cpp CS 311 (All)
//CS311 Yoshii dgraph.cpp // INSTRUCTION: // Complete all the functions you listed in dgraph.h // Comment the file completely using How to Comment file. // Use HW6-help.docx to finish the function... s. //------------------------------------------------------- //====================================================== // HW#: HW6 dgraph // Name: KANISHQ PATEL // File Type: Implementation file //======================================================== #include "dgraph.h" #include <iostream> #include <fstream> #include <string> using namespace std; dgraph::dgraph() { for(int i = 0; i<SIZE; i++){ Gtable[i].vertexName = ' '; // set vertexName Gtable[i].visit = 0;// visit numbers (0) } countUsed = 0; // set countUsed 0 } dgraph::~dgraph() // do we have to delete all nodes of slists in table?? // Question: If we do not do this, will the llist destructor be called automatically??? Try it. { //It will be called automatically } void dgraph::fillTable() // read from the specified file { string fname; //string name is fname cout << "Enter a file name: "; cin >> fname; ifstream fin (fname.c_str(), ios::in); //open file fname // the rest is in HW6-help char addx; while(fin>> Gtable[countUsed].vertexName){// IF I CAN READ THE NAME fin>> Gtable[countUsed].outDegree; // loading the data for(int i = 0; i< Gtable[countUsed].outDegree; i++){ fin>>addx; /////// ( Gtable[countUsed].adjacentOnes).addRear(addx); //slist function from HW3 ////// } countUsed++;//increamenting count } [Show More]
Last updated: 2 years ago
Preview 1 out of 3 pages
Buy this document to get the full access instantly
Instant Download Access after purchase
Buy NowInstant download
We Accept:
Can't find what you want? Try our AI powered Search
Connected school, study & course
About the document
Uploaded On
Apr 17, 2021
Number of pages
3
Written in
This document has been written for:
Uploaded
Apr 17, 2021
Downloads
0
Views
46
In Scholarfriends, a student can earn by offering help to other student. Students can help other students with materials by upploading their notes and earn money.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Scholarfriends · High quality services·