char phrase[81];
char again[31] = "Emmi Schatz";
cout << "Enter your favorite phrase (80 chars max): "; cin >> phrase;
cout << "You entered: " << phrase << endl;
void printstr(char string[]) { int i; for (i = 0 ; string[i] != '\0' ; i++) cout << string[i]; }
int main() { char line[81]; cout << "Enter a string\n"; cin.getline(line,81); int i = 0; while (line[i] != '\0') { while (line[i] != ' ' && line[i] != '\t' && line[i] != '\0') { cout << line[i]; i++; } cout << endl; while (line[i] == ' ' || line[i] == '\t') i++; } }
void revstr(char forward[], char backward[]) { int i, j; i = strlen(forward) - 1; for (j = 0 ; i >= 0 ; j++, i--) backward[j] = forward[i]; backward[j] = '\0'; }
Email Me |
Office Hours |
My Home Page |
Department Home |
MCC Home Page
© Copyright Emmi Schatz 2002