Menu Problems

This is a discussion on Menu Problems within the C++ Programming forums, part of the General Programming Boards category; I have a project here (console address book program)
Code:
#include<iostream>
#include<fstream>
#include<windows.h>
#include<cstdio>
#include<string>
using namespace std;
void clrscr(void) ...

The problem is that when I enter 2 as a choice in the menu, nothing happens...Also, right now it can only add and display entries...I want to be able to 1. *search* the entries 2. sort and display all entries (the other basic functions - edit, delete - can be done by me, I guess)
Edit - Maybe I should put it as an attachment...its filling up the page x_x
-regards,
ultrabot90

choice is an int, '2' is a char with the integer corresponding value of 50. If you enter 50 as your "choice", I'm pretty sure it will do the '2' entry. But you may want to edit the code to either not use the single-quotes or to use a char as input - in this case, both are as valid, but if you intend to have more than 10 choices, you'll have to choose if you want multi-digit inputs (such as 11) or if you want single character, but use for example letters or symbols for the choices that can't be choosen with 0..9.

choice is an int, '2' is a char with the integer corresponding value of 50. If you enter 50 as your "choice", I'm pretty sure it will do the '2' entry. But you may want to edit the code to either not use the single-quotes or to use a char as input - in this case, both are as valid, but if you intend to have more than 10 choices, you'll have to choose if you want multi-digit inputs (such as 11) or if you want single character, but use for example letters or symbols for the choices that can't be choosen with 0..9.

--
Mats

Ouch, thanks (But surely you didn't think I put those single quotes in deliberation? Awful mistake of mine.)
Another question...When the program inputs a line from the user in create_new_record(), it simply skips that section (and shows both the couts). I looked up http://faq.cprogramming.com/cgi-bin/...&id=1043284385
, but when I use getline()...

I think your current code is abotu right, but you may want to add a cin.ignore() after your cin >> choice - that will remove the newline left behind by the cin >> choice and thus allow you to read the first line with getline.

Yet another problem...I tested the program thus -
1. Compiled+Run once, then added an entry, quit.
2. (no changes in code) Compiled+Run again, started function 1 (read from file), quit.
It just gives me junk values...How do I do it? Also, I'd like to know how I can rid myself of that system("PAUSE") in create_new_record()...There's no process.h and exit() function...and return <value> wont work in a structure return type function...
Thanks.