#include<iostream>
#include<cstdio>
#include<cstdlib>
#include <iomanip>
#include <string.h>
#include <ctype.h>
using namespace std;
int inserting(){
}
int sorting(){
}
int startover(){
}
int main(){
char *info[100];
int choose;
int (*ptr[])()={inserting,sorting,startover}… an array of pointers to functions
do{
do{
cout<<"\nPlease select a menu option:\n";
cout<<"\n0)Insert SSN, First Name, Last Name";
cout<<"\n1)Sort and Display Names";
cout<<"\n2)Start Over";
cout<<("\n3)Quit\n");
cin>>choose;
if (choose<0||choose>3)
{
cout<<"\nInvalid selection try again!\n";//Error message for invalid input
}
}while(choose<0||choose>3);//Validatio… loop
if (choose==0)//If statement calling functions using array of pointers
(ptr[0])();
else
if (choose==1)
(ptr[1])();
else
if (choose==2)
(ptr[2])();
else;
}while(choose!=3);
system("pause");
}//main func
This post has been edited by brettfavre9190: 21 July 2009 - 10:24 PM

New Topic/Question
Reply




MultiQuote




|