#include <iostream> #include <cstdlib> #include <cstring> #include <ctype.h> #include <cmath> using namespace std; int main(int argc, char *argv[]) { char buffer[100]= {}; int length = 0; cout << "Enter a string: "; do { cin >> buffer; } while(cin.eof()); length = strlen(buffer); int squareNum = ceil(sqrt(length)); cout << squareNum; cout << buffer; } Basically what I'm trying to do is fill a character array with the string I enter. However I believe it's only writing to the array until a space appears.
Ex. Input: this is a test Output: this Input:thisisatest Output:thisisatest Why is it stopping at the spaces? I'm pretty sure it has to the with the .eof loop