#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;
}
기본적으로 내가하려는 것은 입력 한 문자열로 문자 배열을 채우는 것입니다. 그러나 공간이 나타날 때까지 배열에 쓰기 만한다고 생각합니다.입력 내용이 제 배열에 제대로 쓰여 있습니까?
왜 공백에서 멈추고 있습니까? .eof 루프를 사용하는 것이 확실합니다.