C++程序无法运行

来源:百度知道 编辑:UC知道 时间:2024/05/13 07:17:23
//=========================================================
#include<iostream>
#include<iomanip>
using namespace std;
//---------------------------------------------------------
int main(){
for(int n=1;n<=10;++n)
cout<<setfill('')<<setw(n)<<""
<<setfill('M')<<setw(21-2*n)<<"M"<<endl;
}//========================================================
这个程序为什么VS2005编译报错?

把setfill('')改为setfill(' ')就行了

谁知道呢

你的填充字符为空,故而不行,如果希望填充空格,不放在‘’之间放个空格

报错信息是:empty character constant
他们说的没错,setfill('')应改为setfill(' ')

支持2.4.5楼的看法。

return 0;呢