// if.cpp -- if ¸í·É¹® »ç¿ë #include using namespace std; int main() { char ch; int spaces = 0; int total = 0; cin.get(ch) while (ch != ".") // ¹®ÀåÀÇ ³¡¿¡¼­ Á¾·á { if (ch == " ") // ch°¡ ºó Ä­ÀÎÁö °Ë»ç spaces++; total++; cin.get(ch); } cout << "¹®ÀåÀÇ ÃÑ ¹«ÀÚ ¼ö´Â " << total << " À̰í, "; cout << "±× Áß ºó Ä­Àº " << spaces << "°³ÀÔ´Ï´Ù.\n"; return 0; }