| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 636 人关注过本帖
标题:[求助]如何使用I/O控制符?
只看楼主 加入收藏
chenchao
Rank: 1
等 级:新手上路
帖 子:45
专家分:0
注 册:2006-5-20
收藏
 问题点数:0 回复次数:2 
[求助]如何使用I/O控制符?

//GaloisFieldMatrix.h
...
#include <iomanip>
namespace galois
{
....

}

//GaloisFieldMatrix.cpp
namespace galois
{
...
std::ostream& operator<< (std::ostream& os, const GaloisFieldMatrix& A) //重载输出运算符<<
{
size_t Arow = A.GetRow();
size_t Acol = A.GetCol();
for(int i = 0 ; i < Arow ; i++)
{
for(int j = 0 ; j < Acol ; j++)
os<<setiosflags(iso_base::left) //
<<setw(5) //这两行为啥不对?
<<A.M[i][j].poly()
<<" ";
os<<"\n";
}

return os;
}

.....

}



下面是错误信息:
g:\c++\复件 (7) 测试二z\galoisfieldmatrix.cpp(348) : error C2065: 'setiosflags' : undeclared identifier
g:\c++\复件 (7) 测试二z\galoisfieldmatrix.cpp(348) : error C2653: 'iso_base' : is not a class or namespace name
g:\c++\复件 (7) 测试二z\galoisfieldmatrix.cpp(348) : error C2065: 'left' : undeclared identifier
g:\c++\复件 (7) 测试二z\galoisfieldmatrix.cpp(349) : error C2065: 'setw' : undeclared identifier




搜索更多相关主题的帖子: 如何 include 
2006-06-06 11:56
wfpb
Rank: 6Rank: 6
等 级:贵宾
威 望:29
帖 子:2188
专家分:0
注 册:2006-4-2
收藏
得分:0 

namespace galois
{
...
std::ostream& operator<< (std::ostream& os, const GaloisFieldMatrix& A) //重载输出运算符<<
{
size_t Arow = A.GetRow();
size_t Acol = A.GetCol();
for(int i = 0 ; i < Arow ; i++)
{
for(int j = 0 ; j < Acol ; j++)
os<<setiosflags(iso_base::left) //
<<setw(5) //这两行为啥不对?
<<A.M[i][j].poly()
<<" ";
os<<"\n";
}



必须改一下:
os<<std::setiosflags(std::ios_base::left)
<<std::setw(5)


[glow=255,red,2]wfpb的部落格[/glow] 学习成为生活的重要组成部分!
2006-06-06 12:51
chenchao
Rank: 1
等 级:新手上路
帖 子:45
专家分:0
注 册:2006-5-20
收藏
得分:0 

我知道了,多谢!

2006-06-06 15:40
快速回复:[求助]如何使用I/O控制符?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.018103 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved