如何清除Code :: blocks中的输出屏幕? [英] How to clear the output screen in Code::blocks?

查看:157
本文介绍了如何清除Code :: blocks中的输出屏幕?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Turbo C ++中,您可以这样做

in turbo c++ you could do it like this

#include<conio.h>
void main()
{
     clrscr();
}

但是在代码块中,我不能使用它..:(

But in code blocks i cant use this.. :(

推荐答案

您可以使用 system( cls); 与标题 #include< cstdlib> 。 cls是在DOS / Windows上运行的批处理命令。在其他系统(基于UNIX的系统)上,您可以使用:

cout<< \x1b [2J\x1b [1; 1H<< flush;

You can use system("cls"); with the header #include <cstdlib>. "cls" is a Batch command that works on DOS/Windows. On other systems(UNIX based systems) you might use:
cout << "\x1b[2J\x1b[1;1H" << flush;

我再说一遍,永远不要使用 conio.h。这是一个已弃用的库,它不是标准的一部分,只有少数编译器拥有它。

Never, I repeat, NEVER use "conio.h". Is a deprecated library, that is not a part of standard, and only a few compilers have it.

这篇关于如何清除Code :: blocks中的输出屏幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆