意思就是比如我做一个系统有多个功能选项 输入选择其中一个功能后跳到那个功能的界面 怎么做到的呢 是用cout《endl;刷出来的么?求大神指导
用system("cls");清屏,需要先包含stdlib.h文件。
// ConsoleApplication1.cpp: 主项目文件。
#include "stdafx.h"
#include "iostream"
#include "stdlib.h"
int main(void)
{
std::cout << "1. Hello world!" << std::endl;
std::cout << "2. How are you?" << std::endl;
std::cout << "Enter your choice please:" << std::endl;
int i;
std::cin >> i;
if (i == 1) {
system("cls");
std::cout << "Hello world!" << std::endl;
}
else if (i == 2) {
system("cls");
std::cout << "How are you?" << std::endl;
}
else {
std::cout << "You should enter a number 1 or 2. Others is illeagle." << std::endl;
}
return 0;
}
vs2013中不用MFC的话没有直接跳转到另一个界面的功能吧……
我之前做课程设计的时候就直接在选择某个功能选项之后直接在接下去的一行中显示对应的功能界面……理论上也可以用cout<<endl覆盖之前的主界面,但我觉得没必要啊……能实现功能就行,真要做成切换界面的形式直接用mfc不就行了?
好像nodejs里面有这样的写法
你先打印出先来的选项列表啊,比如(1、登录 2、注册 3、退出),然后让用户输入一个数字之后 再进入另一个页面不就好了么(比如输入1,然后进入登录页面)……