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.

102Part II: Becoming a Functional C++ ProgrammerThe character \y is the character whose numeric value is y. The character \0is the character with a value of 0, otherwise known as the null character.Using that rule, the previous small program becomes// DisplayString - output a character array to// standard output, the MS-DOS window#include #include #include #include using namespace std;// prototype declarationsvoid displayString(char stringArray[]);int main(int nNumberofArgs, char* pszArgs[]){char charMyName[] ={‘S’, ‘t’, ‘e’, ‘p’, ‘h’, ‘e’, ‘n’, 0};displayString(charMyName);}// wait until user is ready before terminating program// to allow the user to see the program resultssystem(“PAUSE”);return 0;// displayString - display a character string// one character at a timevoid displayString(char stringArray[]){for(int i = 0; stringArray[i] != ‘\0’; i++){cout

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

Saved successfully!

Ooh no, something went wrong!