| | void main( ){ int *pi; char *psz; float *pf; char cresponse,cnewline; cout << “Please enter the dynamic data type\n”; cout << “ you would like to create.\n\n”; cout << “Use (s)tring, (i)nt, or (f)loat ”; cin >> cresponse; cin.get(cnewline); switch(cresponse) { case ‘s’: psz=new char[ISTRING_MAX]; cout << “\nPlease enter a string: ”; cin.get(psz,ISTRING_MAX); voutput(psz,cresponse); break; case ‘i’: pi=new int; cout << “\nPlease enter an integer: ”; cin >> *pi; voutput(pi,cresponse); break; case ‘f’: pf=new float; cout << “\nPlease enter a float: ”; cin >> *pf; voutput(pf,cresponse); break; default: cout << “\n\n Object type not implemented!”; }}void voutput(void *pobject, char cflag){ switch(cflag) { case ‘s’: cout << “\nThe string read in: ” << (char *) pobject; delete pobject; break; case ‘i’: cout << “\nThe integer read in: ” << *((int *) pobject); delete pobject; break; case ‘f’: cout << “\nThe float value read in: ” << *((float *) pobject); delete pobject; break; }} | | |