注册 登录
编程论坛 C++教室

【求助】程序清屏时,不能完全清屏

写在人生边上 发布于 2008-03-22 15:05, 460 次点击
#include <iostream.h>
#include <stdlib.h>
void Menu();
void main()
{
    char choose;
    while(1)
    {   
        Menu();
        cin>>choose;
        switch(choose)
        {
            case '1': exit(1);
            default : cout<<"What you input is wrong!\n";
                      cout<<"You can only input the char '1'!\n";
                      break;   
        }
    }
}
void Menu()
{
    system("cls");
    cout<<"                 ---------------------------------------\n";
    cout<<"                 |                Menu                 |\n";
    cout<<"                 |             1.Exit                  |\n";
    cout<<"                 ---------------------------------------\n";
    cout<<"    Please choose :";
}

当我输入'h'并回车时,"What you input is wrong!","You can only input the char '1'!";j竟然出现在  Menu    的上面,这是为什么?  语句system("cls");不是已经清屏了吗?
          请高手指点!
0 回复
1