PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.c > Challenging Logic
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Challenging Logic

Réponse
 
LinkBack Outils de la discussion
Vieux 29/05/2008, 16h58   #1
Nash
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Challenging Logic

Hi,
I am new to c language and i have a problem to solve. Imagine a
parent child relationship let me take menu as an example

File Edit
New Cut
Window Copy
Message
Open

here File and Edit are Top Level Parents(root menu), New and Open are
children of File. Window and MEssage are children of NEw. Similarly
Cut and Copy are children of Edit.

I can have only 2 functions like Next and GetSubMenu. Initially i will
display File when i say next it should show me edit when i say next it
should show me file.

When i am in File when is say get submenu it should display new and
now next should give me open and next should take me to File since
Open is the last child of File. Similary when i am in New and say
GetSubMenu it should give me Window and Next should give me Message
and Next should give me New.

I dont know whether i need to use a bidirectional circular linked list
or array. i need some from you.

Thanks.
--
comp.lang.c.moderated - moderation address: clcm@plethora.net -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.
  Réponse avec citation
Vieux 10/06/2008, 06h56   #2
akbar
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Challenging Logic

On May 29, 8:58pm, Nash <jeevs...@gmail.com> wrote:
> Hi,
> I am new to c language and i have a problem to solve. Imagine a
> parent child relationship let me take menu as an example
>
> File Edit
> New Cut
> Window Copy
> Message
> Open
>
> here File and Edit are Top Level Parents(root menu), New and Open are
> children of File. Window and MEssage are children of NEw. Similarly
> Cut and Copy are children of Edit.
>
> I can have only 2 functions like Next and GetSubMenu. Initially i will
> display File when i say next it should show me edit when i say next it
> should show me file.
>
> When i am in File when is say get submenu it should display new and
> now next should give me open and next should take me to File since
> Open is the last child of File. Similary when i am in New and say
> GetSubMenu it should give me Window and Next should give me Message
> and Next should give me New.
>
> I dont know whether i need to use a bidirectional circular linked list
> or array. i need some from you.
>
> Thanks.
> --
> comp.lang.c.moderated - moderation address: c...@plethora.net -- you must
> have an appropriate newsgroups line in your header for your mail to be seen,
> or the newsgroup name in square brackets in the subject line. Sorry.


Hello Nash,

Below is a similar data structure that accounts your problem ...

typedef struct my_menu
{
char * menu_name;
struct my_menu * next_menu;
sturct my_menu * child_menu;
}my_menu;

The 'struct my_menu * next_menu' pointer should point to the next
menu item, e.g. File>Edit
The 'struct my_menu * child_menu' pointer should point to the child
menu item, e.g. File>New>Window

I hope this s you

Thanks
Akbar
--
comp.lang.c.moderated - moderation address: clcm@plethora.net -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.
  Réponse avec citation
Vieux 10/06/2008, 06h56   #3
akbar
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Challenging Logic

On May 29, 8:58pm, Nash <jeevs...@gmail.com> wrote:
> Hi,
> I am new to c language and i have a problem to solve. Imagine a
> parent child relationship let me take menu as an example
>
> File Edit
> New Cut
> Window Copy
> Message
> Open
>
> here File and Edit are Top Level Parents(root menu), New and Open are
> children of File. Window and MEssage are children of NEw. Similarly
> Cut and Copy are children of Edit.
>
> I can have only 2 functions like Next and GetSubMenu. Initially i will
> display File when i say next it should show me edit when i say next it
> should show me file.
>
> When i am in File when is say get submenu it should display new and
> now next should give me open and next should take me to File since
> Open is the last child of File. Similary when i am in New and say
> GetSubMenu it should give me Window and Next should give me Message
> and Next should give me New.
>
> I dont know whether i need to use a bidirectional circular linked list
> or array. i need some from you.
>
> Thanks.
> --
> comp.lang.c.moderated - moderation address: c...@plethora.net -- you must
> have an appropriate newsgroups line in your header for your mail to be seen,
> or the newsgroup name in square brackets in the subject line. Sorry.


Hello Nash,

Below structure should solve your problem,

typedef struct my_menu
{
char * my_menu_name;
struct my_menu * child_menu;
struct my_menu * next_menu;
}my_menu;

the 'child_menu' pointer shall point to child menu items, e.g.
File>New menu item
the 'next_menu' pointer shall point the next parent menu item e.g.
File>Edit

I hope this s

Thanks
Akbar
--
comp.lang.c.moderated - moderation address: clcm@plethora.net -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 02h38.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,12122 seconds with 11 queries