Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 04-13-2005, 11:01 AM   #1
Member (9 bit)
 
Join Date: Nov 2002
Posts: 502
Use of menus in C

I need to create this program but using menus, but I dont have an Idea of how create menus in C, I know how to use the case function but I don`t know how to build the menu,

#include
#include

void main (void)
{
float mts, km, ton, qq;

printf ("Programa de conversion");
printf ("Digite la cant de km: ");
scanf ("%f",&km);
mts = km*1000;
printf ("Los %.2f km equivalen a %.2f mts", km, mts);
printf ("Digite la cant de QQ: ");
scanf ("%f",&qq);
ton=qq/10;
printf ("Los %.2f qq equivalen a %.2f ton",qq,ton);
getch ();
}
easg is offline   Reply With Quote
Old 04-13-2005, 06:56 PM   #2
Member (10 bit)
 
Join Date: Jul 2002
Location: University of California, Santa Barbara
Posts: 800
Do you want just a regular text menu with numbers for several choices? Here is an excerpt from one of my programs which has a menu based user interface:
Code:
while(c != 0)
{
	printf("Choose the mode\n");
	printf("(1) User defined values\n");
	printf("(2) Walk\n");
	printf("(3) Bounce\n");
	printf("(0) Quit\n");
	printf("------------------------\n");
	scanf("%d", &c);


	switch (c) {
		case 1: UserDef(); break;
		case 2: Walk(); break;
		case 3: Bounce(); break;
		case 0: break;
		default: system("cls"); printf("That is not a valid choice\n\n"); break;
	} 
}
mattg2k4 is offline   Reply With Quote
Old 04-15-2005, 04:40 PM   #3
Member (9 bit)
 
Join Date: Nov 2002
Posts: 502
This example is ok, thank you.
easg is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 07:21 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2