急!!!VC里怎么使用clrscr和gotoxy?
上网查了一下,发现VC不包含conio.h,可是我很急着用clrscr函数和gotoxy函数啊,VC里有没有类似的可用函数呢?如果没有该怎么解决呢???急啊!!!
各路大神帮帮忙啊!!!
各路大神帮帮忙啊!!!
2012-10-04 11:45
2012-10-04 11:51
2012-10-04 12:41
程序代码:
#include <Windows.h>
#include <clocale>
using namespace System;
void wmain(void)
{
_wsetlocale(LC_ALL, L"chs"); // 设定简体中文环境
Console::BackgroundColor = ConsoleColor::DarkBlue;
Console::Clear();
Console::SetWindowSize(Console::LargestWindowWidth / 2, Console::LargestWindowHeight / 2);
Console::ForegroundColor = ConsoleColor::White;
for (Int32 row = 0; row < Console::WindowHeight; ++row)
{
Console::SetCursorPosition(0, row);
Console::Write("{0:D02}", (row + 1));
}
String^ text1 = String::Format(L"当前窗口宽度={0:D}, 高度={1:D}", Console::WindowWidth, Console::WindowHeight);
String^ text2 = String::Format(L"控制台窗口最大宽度={0:D}, 最大高度={1:D}", Console::LargestWindowWidth, Console::LargestWindowHeight);
Console::ForegroundColor = ConsoleColor::Yellow;
Console::SetCursorPosition((Console::WindowWidth - text2->Length - 3) / 2, Console::WindowHeight - 1);
Console::Write(text2);
Console::SetCursorPosition((Console::WindowWidth - text1->Length - 3) / 2, 1);
Console::Write(text1);
Console::ReadLine();
}

2012-10-04 12:53

2012-10-04 12:57
大神写的那么多代码没学过也看不懂啊……跪拜……
2012-10-04 13:29
2012-10-04 13:31

2012-10-04 13:42
2012-10-04 16:39
2012-10-04 16:51