switch bogus

This switch isn't working right it. It is supposed to get the information from the user for the entry to be deleted. What happens is that it goes right to default. I don't get it ....

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
//Option U function message
	cout << "----You have selected option U.----" << endl;
	
	// To get record.
	cout << "Please enter the last name of record to be updated." << endl;
	
	//Get last name
	cin >> lname;
	
	//Convert first letter to upper
	lname[0] = toupper(lname[0]);
	
	//Find record
	while( index < size && !found )
	{
	  if(tele[index].lname.compare(lname)== 0)
	  {
		cout << endl;
		cout << "The entry to be updated is:" << endl;
		cout << tele[index].lname << endl;
		cout << tele[index].fname << endl;
		cout << tele[index].streetAdd << endl;
		cout << tele[index].cityStateZ << endl;
		cout << tele[index].phone << endl;
		cout << endl;
		    found = true;
	  }
		else if(!found)
		index++;
	}
	
	// If Entry is not located
	if(index == size)
		{
			cout << "Cannot Locate entry." << endl;
			cout << "Returning to menu." << endl;
			Sleep(2000);
			return MENU;
		}
	
	//User prompt
	cout << "Please select from one of the following:" << endl;
	cout << "1. Update last name." << endl;
	cout << "2. Update first name." << endl;
	cout << "3. Update street Address." << endl;
	cout << "4. Update city, state, and zip code." << endl;
	cout << "5. Update phone number." << endl;

	// To get selection	
	cout << endl;
	cout << "Enter choice" << endl;
	cin >> choice;
	switch(choice)
	{
	case 1: cout << "Please type the new last name. " << endl;
		cin.get();
		getline(cin,newLname);
		newLname[0] = toupper(newLname[0]);
		tele[index].lname = newLname;
		break;
	case 2: cout << "Please type the new first name. " << endl;
		cin.get();
		getline(cin, newFname);
		tele[index].fname = newFname;
		break;
	case 3: cout << "Please type the new  street address" << endl;
		cin.get();
		getline(cin,newAdd); 
		tele[index].streetAdd = newAdd;
		break;
	case 4: cout << "Please type the new  city, state, and zip code." << endl;
		cin.get();
		getline(cin,newCSZ); 
		tele[index].cityStateZ = newCSZ;
		break;
	case 5: cout << "Please type the new phone number."<< endl;
		cout << "(Example, 555-555-5555) " << endl;
		cin.get();
		getline(cin, newPhone);
		tele[index].phone = newPhone;
		break;
	default: cout << "Invalid selection. " << endl;
			 cout << "Returning to Main Menu." << endl;
			 Sleep(2000);
			 return MENU;
	}
	//Display updated entry updated
	cout << endl;
	cout << "--Updated information--. " << endl;
	cout << tele[index].lname << endl;
	cout << tele[index].fname << endl;
	cout << tele[index].streetAdd << endl;
	cout << tele[index].cityStateZ << endl;
	cout << tele[index].phone << endl;
	cout << endl;
	
  //To exit function
  cout << "Enter 'R' to return to Main Menu." << endl;
  while(choice2 !='R')	
  {
	cin >> choice2;
	choice2 = toupper(choice2);
	if(choice2 == 'R')
	{
	  return MENU;
	}
	else if(choice2 != 'R')
	{
	   cout << "Invalid, Please enter 'R' " << endl;
	}
  }
}

}
Scratch that I got it
Topic archived. No new replies allowed.