Solved

Menu Driven Applications

Posted on 2004-04-22
6
420 Views
Last Modified: 2010-04-15
Hi

Being generally disorganised and now panicing, I would appreciate any help to get me moving:

I have a c programming problem which has to be menu driven. Must accept data to a named file, save, read, sort and perform various actions upon this data held. When selected from the menu.

Problem is i have only done basic programms and for the above, I haven't a clue were to start. Any help will be gratefully recieved.

Cheers  Mozzle

0
Comment
Question by:mozzle
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
6 Comments
 
LVL 11

Accepted Solution

by:
avizit earned 50 total points
ID: 10891000
I presume you have to make a text based menu

well to begin with first

1.you have to  present the menu to the user
for that use printf () (or puts() ) to output something on the screen say

##### what is your name ?

2. now you have to get the user input for that you use

scanf() ( or gets() as the case maybe )

3. after you have read the user input you can base your further action depending on the input

for example like

if (inout == 'd' ){

 // delete action
}else if (inout == 'q'){
 //quit action  

etc etc

hope it helps . to get you started .

come back if you after you have started and face more problems.

/abhijit/
0
 
LVL 1

Expert Comment

by:ravenscr98
ID: 10891041
Sounds like a panicked homework problem.  We cannot give code, but we can give lots of advice.

First, you need to clarify what you mean by menu system.  Are you supposed to use a GUI system such as Windows or gnome?  Or are you supposed to print a list of options, have the user enter their choice, then process it? There's too many options for "menu system" to give you any advice.
0
 
LVL 9

Assisted Solution

by:ankuratvb
ankuratvb earned 50 total points
ID: 10891057
use switch..case along with getchar() to get the choice.

If you are using Borland's compilers,you can use getch() for getting user input.

char ch;
printf("1..");
printf("2..");
printf("3..");
printf("4..");
ch=getchar();//or ch=getch();
switch(ch)
{
 case '1'://do something
              break;
 case '2'://do something
              break;
 case '3'://do something
              break;
 case '4'://do something
              break;

 default:printf("Invalid choice");
             break;

}
0
 
LVL 9

Expert Comment

by:ankuratvb
ID: 10891081
Make it loop so that it asks again if there is an invalid choice/
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand opening and reading files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question