COUT [英] cout
问题描述
如何让cout不在控制台上打印。我的意思是
void main()
{
cout<<"" Hello world"< < endl;
}
我有什么方法可以在控制台上阻止打印,即使我在我的代码中使用了我的b $ b cout ..我意味着甚至使用cout<<<"<<<< endl;。
这不应该打印在控制台上..
问候
How to make cout not printing on the console. i mean
void main()
{
cout<<"Hello world"<<endl;
}
Is there any way where i can block printing on console even when iam
cout in my code..I mean even using cout<<"Hello world"<<endl;.
This is shouldnt get printed on console..
regards
推荐答案
" Gurikar" < MS ******* @ gmail.com>在消息中写道
news:11 ********************** @ g49g2000cwa.googlegr oups.com ...
"Gurikar" <ms*******@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
如何让cout不在控制台上打印。我的意思是
void main()
int main()
{
cout<< ;Hello world<< endl;
}
有什么方法我可以在控制台上阻止打印,即使我在我的代码中使用了我...即使使用cout<<<"&#;<<< endl;。
这不应该在控制台上打印..
问候
How to make cout not printing on the console. i mean
void main()
int main()
{
cout<<"Hello world"<<endl;
}
Is there any way where i can block printing on console even when iam
cout in my code..I mean even using cout<<"Hello world"<<endl;.
This is shouldnt get printed on console..
regards
如果您不打印到控制台,则不要打印到控制台。
字符串Hello world是一个文字。它不是变量。要存储
文字字符串,请使用它来初始化std :: string变量。
#include< iostream>
#include< string>
int main()
{
std :: string s(" Just a string.\\\
");
s + ="只是另一个字符串。\ n" ;;
// std :: cout<< s<< std :: endl;
返回0;
}
作业:
什么是变量?
什么是字符串?
为什么不允许使用void main()?
If you prefer not to print to the console, then don''t print to the console.
The string "Hello world" is a literal. Its not a variable. To store the
literal string, use it to initialize a std::string variable.
#include <iostream>
#include <string>
int main()
{
std::string s("Just a string.\n");
s += "Just another string.\n";
// std::cout<< s << std::endl;
return 0;
}
Homework:
Whats a variable?
Whats a literal string?
Why is void main() not allowed?
>
直接从字符串文字打印有什么问题?用户只想要
来询问如何将cout重定向到其他地方。
所以答案是使用std :: ios :: rdbuf()函数。一个谷歌搜索将
给出似乎合理的许多例子:)
ben
What''s wrong of printing straight from string literal? The user just wants
to ask how to redirect cout to somewhere else.
So the answer is to use std::ios::rdbuf() function. A google search would
give plausible many examples :)
ben
如果您不想打印到控制台,然后不打印到
控制台。字符串Hello world是一个文字。它不是变量。要存储
文字字符串,请使用它来初始化std :: string变量。
If you prefer not to print to the console, then don''t print to the console. The string "Hello world" is a literal. Its not a variable. To store the
literal string, use it to initialize a std::string variable.
Gurikar on 2005-05-12 09:10垃圾邮件:
Gurikar on 2005-05-12 09:10 spammed:
如何让cout不在控制台上打印。我的意思是
How to make cout not printing on the console. i mean
cout.rdbuf(other_buffer);
-
SirMike
代码是我的力量
http://www.sirmike.grudziadz.com
这篇关于COUT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!