i updated the codeCode:// Stopping input with an empty string #include <iostream> #include <cstring> using namespace std; int main() { int i = 1; char temp[80]; char string[80]; // room for 255 strings cout << "\n\nEnter some strings - (blank to exit)" << " \nfirst string: "; cin.getline(temp, 80); while (temp[0] != '\0') { cout << "String " << i << " : " << temp << "\nnext string: "; cin.getline(temp, 80); string == strcat(string," "); string == strcat(string,temp); i++; } cout << "\n\n"; //for (int index = 0; index < i; index++) cout << string ; }
input: bill loves to eat
output: $ loves to eat
$ is a weird character that show up. i don't know what it is.



LinkBack URL
About LinkBacks




