11.07.2015 Views

tYSR20

tYSR20

tYSR20

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 7: Storing Sequences in Arrays 105// safer alternative// cin.getline(szString1, 128);// ...now the second string...char szString2[128];cout > szString2;// safer alternative// cin.getline(szString1, 128);// accumulate both strings into a single bufferchar szString[260];// copy the first string into the buffer...strncpy(szString, szString1, 128);// ...concatenate a “ - “ onto the first...strncat(szString, “ - “, 4);// ...now add the second string...strncat(szString, szString2, 128);// ...and display the resultcout

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!