请问在c++中gcount()函数如何使用的啊?
在书上没有找到关于gcount()的用法介绍。希望您能给我以帮助,如果有程序实例就更好了。谢谢!...
在书上没有找到关于gcount()的用法介绍。
希望您能给我以帮助,如果有程序实例就更好了。
谢谢! 展开
希望您能给我以帮助,如果有程序实例就更好了。
谢谢! 展开
2个回答
展开全部
istream::gcount
int gcount() const;
Remarks
Returns the number of characters extracted by the last unformatted input function. Formatted extraction operators may call unformatted input functions and thus reset this number.
example:
#include <iostream>
using namespace std;
int main( )
{
cout << "Type the letter 'a': ";
ws( cin );
char c[10];
cin.get( &c[0],9 );
cout << c << endl;
cout << cin.gcount( ) << endl;
}
输入a
输出1
gcount() 用来统计 read() 读到的字符数
int gcount() const;
Remarks
Returns the number of characters extracted by the last unformatted input function. Formatted extraction operators may call unformatted input functions and thus reset this number.
example:
#include <iostream>
using namespace std;
int main( )
{
cout << "Type the letter 'a': ";
ws( cin );
char c[10];
cin.get( &c[0],9 );
cout << c << endl;
cout << cin.gcount( ) << endl;
}
输入a
输出1
gcount() 用来统计 read() 读到的字符数
展开全部
istream::gcount
int
gcount()
const;
Remarks
Returns
the
number
of
characters
extracted
by
the
last
unformatted
input
function.
Formatted
extraction
operators
may
call
unformatted
input
functions
and
thus
reset
this
number.
example:
#include
<iostream>
using
namespace
std;
int
main(
)
{
cout
<<
"Type
the
letter
'a':
";
ws(
cin
);
char
c[10];
cin.get(
&c[0],9
);
cout
<<
c
<<
endl;
cout
<<
cin.gcount(
)
<<
endl;
}
输入a
输出1
gcount()
用来统计
read()
读到的字符数
int
gcount()
const;
Remarks
Returns
the
number
of
characters
extracted
by
the
last
unformatted
input
function.
Formatted
extraction
operators
may
call
unformatted
input
functions
and
thus
reset
this
number.
example:
#include
<iostream>
using
namespace
std;
int
main(
)
{
cout
<<
"Type
the
letter
'a':
";
ws(
cin
);
char
c[10];
cin.get(
&c[0],9
);
cout
<<
c
<<
endl;
cout
<<
cin.gcount(
)
<<
endl;
}
输入a
输出1
gcount()
用来统计
read()
读到的字符数
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询