Can anybody tell me how to fix this...i've tried many ways but it still ends up the same...???
//Ch7AppE03JV.cpp
//displays an employee's name when the employee's ID is entered
//Created/revised by Justin Victa on October 14, 2011
#include <iostream>
#include <string>
using std::cout;
using std::cin;
using std::endl;
using std::string;
int main()
{
//declare variables
int ID = 0;
string Name = "";
//get ID number
cout << "Please enter ID number: ";
cin >> ID;
while (ID >= 0)
{
if (ID = 1234)
Name = "Sue Nguyen";
//display employee name
cout << "Employee name: " << Name << endl;
break;
else if // <--error C2181: illegal else without matching if
(ID = 1345)
Name = "Janice Blackfeather";
//display employee name
cout << "Employee name: " << Name << endl;
break;
else if// <--error C2181: illegal else without matching if
(ID = 3456)
Name = "Allen Kraus";
//display employee name
cout << "Employee name: " << Name << endl;
break;
else if // <--error C2181: illegal else without matching if
(ID = 4567)
Name = "Margie ODonnell";
//display employee name
cout << "Employee name: " << Name << endl;
break;
else // <--error C2181: illegal else without matching if
Name = "Incorrect ID - Please try again.";
//end ifs
//get next ID
cout << "Next ID: ";
cin >> ID;
} //end while
return 0;
} //end of main function