Logo 
Search:

C Programming Forum

Ask Question   UnAnswered
Home » Forum » C Programming       RSS Feeds

Menu program for C Programming

  Asked By: Macky    Date: Oct 23    Category: C Programming    Views: 4478
  

hi below is my program but i can make it run, can someone help me thanks.

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>

int list[10];

int main(int argc, char *argv[])
{
int x;
srand ( time(NULL) );
for(x=0;x<9;x++)
list[x] = rand() % 1000 + 1;


int selected;

do{
selected = menu();
switch(selected){
case 1: list_access(); break;
case 2: list_replace(); break;
case 3: list_append(); break;
case 4: list_insert(); break;
case 5: list_delete(); break;
case 6: list_search(); break;
case 7: list_sort(); break;
case 8: list_merge(); break;
case 9: list_catenate(); break;
case 0:
printf("\n\nTERMINATE THE PROGRAM\n");

break;
}

}while(selected!=0);

system("PAUSE");
return 0;
}
int show_list()
{
int x;
printf("________________________________________________________________");
printf("\nLIST: ");
for(x=0;x<10;x++)
{
printf("| %d ", list[x]);
}
printf("\n_______________________________________________________________");
}

int menu()
{
int input;
system("cls");
show_list();
printf("\n----------");
printf("\nLIST MENU");
printf("\n-----------");
printf("\n1 - ACCESS");
printf("\n2 - REPLACE");
printf("\n3 - APPEND");
printf("\n4 - INSERT");
printf("\n5 - DELETE");
printf("\n6 - SEARCH");
printf("\n7 - SORT");
printf("\n8 - MERGE");
printf("\n9 - CATENATE");
printf("\n0 - QUIT");
printf("\n\nENTER YOUR CHOICE: ");
scanf("%d",&input);
return input;
}
list_access()
{
system("cls");
printf("\n\nperform access\n");
system("PAUSE");
}
list_replace()
{
system("cls");
printf("\n\nperform replace\n");
system("PAUSE");
}
list_append()
{
system("cls");
printf("\n\nperform append\n");
system("PAUSE");
}
list_insert()
{
system("cls");
printf("\n\nperform insert\n");
system("PAUSE");
}
list_delete()
{
system("cls");
printf("\n\nperform delete\n");
system("PAUSE");
}
list_search()
{
system("cls");
printf("\n\nperform search\n");
system("PAUSE");
}
list_sort()
{
system("cls");
printf("\n\nperform sort\n");
system("PAUSE");
}
list_merge()
{
system("cls");
printf("\n\nperform merge\n");
system("PAUSE");
}
list_catenate()
{
system("cls");
printf("\n\nperform catenate\n");
system("PAUSE");
}

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Abhishek Singh     Answered On: May 22

it is right.
check syntax.

 
Didn't find what you were looking for? Find more on Menu program for C Programming Or get search suggestion and latest updates.




Tagged: