如何在C ++中使用gotoxy()和textcolor() [英] How to use gotoxy() and textcolor() in C++

查看:81
本文介绍了如何在C ++中使用gotoxy()和textcolor()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用代码块来使用C ++对事物进行编码.

I'm using Codeblocks to coding my things using C++.

我记得在C中我可以使用gotoxy()功能和textcolor(),但是在C ++中该库不起作用.

I remember that in C i can use gotoxy() features and textcolor(), but in C++ that library doesn't work.

有什么主意吗?...

Any idea?...

如何在C ++中使用这些功能?.

How can i use those functions in C++?.

推荐答案

gotoxy() textcolor()是系统相关的函数.它们不是标准的一部分,也不是可移植的.

gotoxy() and textcolor() are system dependent functions. They are not part of the standard and not portable.

两种可能性:

  1. 使用相同的开发环境,您可以使它们在C中而不是在C ++中工作.在这种情况下,它的肯定是 conio2.h ,它没有为C函数提供外部"C" .因此,链接器将找不到它们.

  1. with the same development environment you can get them to work in C and not in C++. In this case, its certainly conio2.h which doesn't provide for extern "C" for the C functions. The linker will not find them for this reason.

在您的新开发环境中,未提供以下功能:

with your new development environment these functons are not provided:

  • 如果您在Windows下,可以查看此问题,以了解如何创建自己的问题.
  • 如果您使用的是Linux,则最好看看 curses/ncurses 库.或使用它来模拟 gotoxy(),如此处所述.
  • If you're under windows, you can have a look at this SO question to see how to create your own.
  • If you're under Linux, you'd better have a look at the curses/ncurses library. Or use it to emulate gotoxy() as explained here.

这篇关于如何在C ++中使用gotoxy()和textcolor()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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