using namespace std;
struct Teletype
{
string name;
string phonenum;
Teletype *nextaddr;
};
void populate(Teletype *);
void displayrecord(Teletype *);
//void insertrecord(Teletype *); // create
//void removerecord(Teletype *); //create
//void modifyrecord(Teletype *); // create
//int find(TeleType *, string); // Extra Credit create
bool check();
int main()
{
int location = 0;
int count = 0;
char answery_n;
Teletype *list, *current;
list = new Teletype;
current = list;
cout < "please="">
do
{
count++;
populate(current);
if (check() == false)
{
cout < "="" not="" storage="" available"=""><>
}
else
{
current->nextaddr = new Teletype;
current = current->nextaddr;
cout < "would="" you="" like="" to="" input="" more="" data?="" y/n="" :="">
cin >> answery_n;
cout <>
cin.get();
if (answery_n != 'y')
{
current->nextaddr = NULL;
break;
}
}
} while (answery_n == 'y');
cout < "the="" linked="" list="" records:="" "=""><>
displayrecord(list);
cout < "there="" are="" "="">< count="">< "="" records="" in="" the="" data="" file.="" "=""><>
while (1)
{
cout < "select="" from="" the="" menu="" "=""><>
cout < "1.="" insert="" new="" structure="" in="" the="" linked="" list"=""><>
cout < "2.="" modify="" an="" existing="" structure="" in="" the="" linked="" list"=""><>
cout < "3.="" delete="" an="" existing="" structure="" from="" the="" list"=""><>
cout < "4.="" find="" an="" existing="" structure="" from="" the="" list"=""><>
cout < "5.="" exit="" from="" the="" program"=""><>
cin >> answery_n;
//****************************************
// Continue …
}
system("pause");
return 0;
}
//*******************************
void populate(Teletype *record)
{
cout < "enter="" a="" name:="" "=""><>
getline(cin, record->name);
cout < "enter="" phone="" number:="" "=""><>
getline(cin, record->phonenum);
return;
}
//*******************************
void displayrecord(Teletype *contents)
{
while (contents != NULL)
{
cout < endl="">< setiosflags(ios::left)="">< setw(29)="">< contents-="">name < setw(19)="">< contents-="">phonenum;
contents = contents->nextaddr;
}
cout <>
return;
}
//*******************************
bool check()
{
if (new Teletype == NULL)
{
return false;
}
else
{
return true;
}
}