如何获得对控制台的完全控制? [英] How to get full control over the console?

查看:73
本文介绍了如何获得对控制台的完全控制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我当前正在编写一个C ++程序,该程序必须能够在终端中显示旋转的多维数据集。 (作业)。因此,我从一个60 * 60的字符数组(确切地说是二维矢量)开始,我将其写入屏幕。但是,如果我只使用两个for循环和 std :: cout 来执行此操作,则会得到非常难看的输出:只是前一个屏幕下方的屏幕无休止。

I am currently writing a C++ program which must be able to show a rotating cube in a terminal. (school assignment). So I start off with a 60*60 array (two-dimensional vector, to be exact) of chars, which I am going to write to the screen. But if I just do this with two for-loops and std::cout I get very ugly output: just the screen under the previous one, endlessly.

所以我需要更好的东西,我需要做一些像Vim一样的事情:它似乎接管了控制台,完成后它消失了,终端又回来了。我该怎么办呢?

So I need something better, I need to do something like what Vim does: it seems to take over the console, and when you are done it dissapears, and you terminal is back. How can I do this?

推荐答案

您可以使用 ncurses 来做到这一点。

You can use a library like ncurses to do this.

这篇关于如何获得对控制台的完全控制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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