### Pointer Display Number Of Days When Name Of The Month Entered

I Need Help With This Binary Search Tree Program Where User Have Option Of Choose From The Menu.

I Stuck At The Case Where User Asked To Enter The Name Of The Month For Program To Search And Display The Number Of Days In That Month.

Could Somebody Help Me How To Code That Function Or Some Ways To Make This Case Working, Please?

Here Is What I've Gotten So Far And Been Stuck At Case 5:
 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131`` ``````#include #include using namespace std; struct node { string info; node *left; node *right; }; void insert (node *&q, string s) { node *r; r = new (node); r -> info = s; r -> left = NULL; r -> right = NULL; if (q == NULL) { q = r; } else { if ( s < q -> info ) { insert (q -> left , s); } else { insert (q -> right , s); } } } void sort (node *q) { if (q != NULL) { sort (q -> left); cout< info<<" "; sort (q -> right); } } void displayLeaves (node *q) { if (q != NULL) { displayLeaves(q -> left); if (q -> left == NULL && q -> right == NULL) { cout<< q -> info<<" "; } displayLeaves(q -> right); } } void displayChildren (node *q) { if (q != NULL) { displayChildren(q -> left); if (q -> left != NULL && q -> right != NULL) { cout< info<<" "; } displayChildren(q -> right); } } void theOneChild (node *q) { if (q != NULL) { theOneChild(q -> left); if (q -> left == NULL && q -> right == NULL) { cout< info<<" "; } else if ( q -> left != NULL && q -> right != NULL) { cout< info<<" "; } theOneChild(q -> right); } } /*----------------------------------------------- void displayDays(node *q, int days) { if (q != NULL) displayDays ( //!@#\$%^&* } ------------------------------------------------*/ int main() { int choice; node *tree; char yesNo; string month[12] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; int days[12] = {31, 28, 31, 30, 31,30, 31, 31,30, 31, 30, 31}; tree = NULL; for (int i = 0; i < 12; ++i) { insert(tree, month[i]); } cout<<"\n--------------------------------- OPTIONS ------------------------------------\n\n"; cout<<"1. Display name of month in alphabetical order\n"<< "2. Display leaves of the tree in alphabetical order\n"<< "3. Display parents with two children\n"<< "4. Display parents with only one child\n"<< "5. Enter the name of a month to display the number of days in that month\n\n"<< "------------------------------------------------------------------------------\n\n"; do{ cout<<"Please enter your choice (1 ~ 5): "; cin>>choice; switch (choice) { case 1: sort(tree); break; case 2: displayLeaves(tree); break; case 3: displayChildren(tree); break; case 4: theOneChild(tree); break; case 5: cout<<"Enter the name of the month to display the number of days in that month: "; // !@#\$%^&* } cout<>yesNo; } while (yesNo == 'y' || yesNo == 'Y'); //Termina system("pause"); return 0; }``````
Topic archived. No new replies allowed.