Question: I need help C++ program into C. Thank you for the help Please keep the classes the same and change the cpp classes into c

I need help C++ program into C.

Thank you for the help

Please keep the classes the same and change the cpp classes into c

Contacts.cpp

#include #include "Contacts.h" using namespace std; ContactNode::ContactNode(){ nextNodePtr=NULL; } ContactNode::ContactNode(string name, string phoneNum){ contactName=name; contactPhoneNum=phoneNum; }

void ContactNode::InsertAfter(ContactNode *nextNode){ ContactNode *temp; if(nextNodePtr==NULL) nextNodePtr=nextNode; else{ temp=nextNodePtr; while(temp!=NULL){ temp=temp->GetNext(); } temp=nextNode; } }

string ContactNode::GetName(){ return contactName; }

string ContactNode::GetPhoneNumber(){ return contactPhoneNum; }

ContactNode* ContactNode::GetNext(){ return nextNodePtr; }

void ContactNode::PrintContactNode(){ ContactNode *temp; cout<<"Contact Name: "<PrintContactNode(); }

Contacts.h

#ifndef Contact_H #define Contact_H #include using namespace std; class ContactNode{ public: ContactNode(); //constructor ContactNode(string name, string phone); void InsertAfter(ContactNode*); string GetName(); string GetPhoneNumber(); ContactNode* GetNext(); void PrintContactNode(); private: string contactName; string contactPhoneNum; ContactNode* nextNodePtr; }; #endif

Main.cpp

#include #include "Contacts.cpp" using namespace std;

int main(){ ContactNode contactList; string name; string phoneNum; for(int i=0;i<3;i++){ cout<<"Enter name: "; cin>>name; cout<<"Enter phone number: "; cin>>phoneNum; contactList.InsertAfter(new ContactNode(name,phoneNum)); } cout<

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!