[违规紫衫]关于直接跳过输入的问题
  • 板块灌水区
  • 楼主xiaoyh
  • 当前回复9
  • 已保存回复9
  • 发布时间2023/5/12 12:14
  • 上次更新2023/10/23 16:02:52
查看原帖
[违规紫衫]关于直接跳过输入的问题
628970
xiaoyh楼主2023/5/12 12:14
#include<iostream>
#include<cmath>
#include<cstdio>
#include<conio.h>
#include<windows.h>
#include<cstring>
#include<iomanip>
/*code*/
using namespace std;
int password,beat;
double g=0.0;
bool check[13],h[13]={0,1,0,0,1,1,0,1,0,1,0,0,0},f;
char s;
int n=0,p[4];// [1]:floor [2]:class [3]:place
bool num[6];
int q,u;
void c(){
	system("cls");
}
void a(){
	system("pause");
}
void w(int time){
	Sleep(time);
}
int main(){
	cout<<"觉醒之路>启动"<<endl; 
	w(1000);
	c();
	cout<<"觉醒之路>登录"<<endl;
	cout<<"请登录:"<<endl<<endl<<"输入U,输入用户名。没有账号请输入除u外任意字符打开游客模式。注册用户请于admin(作者)洽谈。"<<endl;
	s=getch();
	c();
	if(s=='U'){
		cout<<"your user id:";
		cin>>q;
		if(q==0){
			freopen("H:\\项目文件\\觉醒之路\\user id\\觉醒之路user0-admin.txt","r",stdin);
			cin>>beat;
			cin>>password;
			fclose(stdin);
			cout<<endl;
			cout<<"password:";
			cin>>u;
			if(password==u){
				cout<<endl<<"correct!";
				w(1000);
				c();
				int e[9][9];
				for(int o=1;o<=50;o++){
					for(int i=1;i<=8;i++){
						for(int j=1;j<=8;j++){
							e[i][j]=1+rand()%9;
						}
					}
					for(int i=1;i<=8;i++){
						for(int j=1;j<=8;j++){
							cout<<e[i][j]<<' ';
						}
						cout<<endl;
					}
				}
			}else{
				cout<<"wrong!";
			}
		}
	}else{
		cout<<"打开游客模式。"; 
	}
	w(2000);
	c();

各位,江湖救急,这段代码在运行到

cout<<"password:"; 
cin>>u;

这个位置的时候直接跳过输入了,大家帮忙看看。 (freopen文件夹路径确认无误)

2023/5/12 12:14
加载中...