?? io20_2_1.02.c
字號(hào):
// #include <iostream>
// #include <iomanip>
#include <iostream.h>
#include <iomanip.h>
/*
* the program generates the following unexpected results:
* $ a.out
* The winter of our discontent
*
* The
* win
* ter
* of
* our
* dis
* con
* ten
* t
*
* The problem is that setw() is passed the size
* of the character pointer rather than the size
* of the character array to which it points.
*
* correct: while ( cin >> setw( bufSize ) >> pbuf )
*/
int main()
{
const int bufSize = 24;
char buf[ bufSize ];
char *pbuf = buf;
// each string greater than sizeof(char*)
// is broken into two or more strings
while ( cin >> setw( sizeof( pbuf )) >> pbuf )
cout << pbuf << endl;
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -