CS 153 Data Structures I
Programming Assignment #2

Due: 1/25/00

This programming assignment is designed to:

Create a VC++ GUI that contains the following edit boxes
  1.  Full SSN (type is CString)
  2.  1st 3 digits of SSN (type is int)
  3.  2nd 2 digits of SSN (type is int)
  4.  3rd 4 digits of SSN (type is int)


and the following buttons

  1. Concatenate from Individual numbers to Full
  2. Parse from Full SSN to Individual numbers


When Button Concatenate is clicked the contents of 1st, 2nd and 3rd should be formatted and placed into Full SSN as:  123-45-6789
When Button Parse is clicked the contents of Full SSN should be parsed into 1st, 2nd and 3rd as:   123    45     6789

Upon entering an OnButtonParse function:

  1. UpdateData(TRUE);
  2. You must move the individual characters from the CString to 3 seperate NULL terminated character arrays
  3. Use the library function atoi(...) to convert the 3 character arrays to 3 ints.
  4. UpdataData(FALSE);
Upon entering an OnButtonConcatenate function:
  1. UpdateData(TRUE);
  2. You must convert the 3 ints to 3 NULL terminated character arrays using the library function itoa(...)
  3. Assisn the 1st character array to a CString variable.
  4. Concatenate a "-" followed by the 2nd character array followed by another "-" etc.
  5. UpdataData(FALSE);
void CProg2Dlg::OnBUTTONParse()
{
 char first[4], second[3], third[5], all[10];
 UpdateData(TRUE);
 strcpy(all,m_Full);
 strncpy(first,all+0,3);
 m_1st = atoi(first);
 strncpy(second,all+4,2);
 m_2nd = atoi(.  .   .     .
 UpdateData(FALSE);
 
}