You are here:

C++/This is about as far as i can go

Advertisement


Question
       printf("\n          MENU");
  printf("\n1: Enter Data from Keyboard");
  printf("\n2: Display data to screen");
  printf("\n3: Sort Data");
  printf("\n4: Write data to file data.txt");
  printf("\n5: Read Data from File data.txt");
  printf("\n6: Exit");
how can i do a program to do all these in the menu?

Answer
In a menu, you need a loop:

bool done = false;
int option;
while(!done){
 // do your printf() stuff here
 scanf("%d", option);
 switch(option){
   case 1: // do things for 1
         break;
   // put other cases here
   case 6: done = true;
 }
}

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


Sam

Expertise

You may ask me about simple to complicated C/C++ programming methods/style and most like questions about network programming in C++.

Experience

I'm a professional programer in C++ and network/internet programming.

©2016 About.com. All rights reserved.