Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Menu Driven Applications

Posted on 2004-04-22
6
Medium Priority
?
431 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 200 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 200 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.

704 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