编程语言
首页 > 编程语言> > c++学生录入系统7.0

c++学生录入系统7.0

作者:互联网


增加了批量导入!!!多个学生不再是难题!!!


——————————————————丑不拉几的分割线———————————————————

#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<cstdio>
#include<stdio.h>
#include<bits/stdc++.h>
#include<conio.h>
#include<iostream>
#include<windows.h>
#include<conio.h>
#include<time.h>
#include<string>
#include <fstream>
#define key_down(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)//检测按键按下
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0) 
using namespace std;
int cmp(int a,int b) {
	return a>b;
}
struct stu {
	char name[999],jj[999],xx[999];
	long long int xh,xb,nl;
};
string lr="1.同学录入",cz="2.同学查找",sc="3.同学删除",jx="4.惊喜",zz="5.制作",ks="6.考试",c__="     c++系统",hb="7.画板";
string dj="8.模拟鼠标点击",dr="9.批量导入";
stu xs[9999];
char xxx[999];
bool b=false;
POINT p;
HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
HWND h=GetForegroundWindow();
CONSOLE_FONT_INFO consoleCurrentFont;
 
//----------移动光标----------
void gotoxy(int x, int y) {
	COORD pos = {x,y};
	HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
	SetConsoleCursorPosition(hOut, pos);
}
 
//----------隐藏光标----------
void HideTheCursor() {
	CONSOLE_CURSOR_INFO cciCursor;
	HANDLE hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
 
	if(GetConsoleCursorInfo(hStdOut, &cciCursor)) {
		cciCursor.bVisible = FALSE;
		SetConsoleCursorInfo(hStdOut, &cciCursor);
	}
}
 
//看不懂的函数——————
HWND hwnd=GetForegroundWindow();
POINT mouse_pos() {			
	CONSOLE_FONT_INFO consoleCurrentFont;
	HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
	POINT p;
	GetCursorPos(&p);
	ScreenToClient(hwnd,&p);      
	GetCurrentConsoleFont(hOutput, FALSE, &consoleCurrentFont);
	int x=p.x/=consoleCurrentFont.dwFontSize.X;
	int y=p.y/=consoleCurrentFont.dwFontSize.Y;
	p= {y,x};
	return p;
}
bool press(int x1,int y1,int x2,int y2) {
	POINT p;
	p=mouse_pos();
	if(p.x>=x1&&p.x<=x2&&p.y>=y1&&p.y<=y2)return true;
	return false;
}
//看不懂的函数——————
 
 int main() {
	system("mode 80,40");
	system("color f0");
 
	//----------移除快速编辑模式(对于win10用户)----------
	HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
	DWORD mode;
	GetConsoleMode(hStdin, &mode);
	mode &= ~ENABLE_QUICK_EDIT_MODE;
	SetConsoleMode(hStdin, mode);
	//----------移除快速编辑模式(对于win10用户)----------
 	//打印__________
	HANDLE hOut;
	hOut = GetStdHandle(STD_OUTPUT_HANDLE);
	SetConsoleTextAttribute(hOut,
	                        FOREGROUND_BLUE |
	                        BACKGROUND_RED | BACKGROUND_BLUE | BACKGROUND_GREEN | BACKGROUND_INTENSITY |
	                        COMMON_LVB_UNDERSCORE);
	gotoxy(0,0);
	printf(c__.c_str());
	cout<<endl;
	printf(lr.c_str());
	cout<<endl;
	printf(cz.c_str());
	cout<<endl;
	printf(sc.c_str());
	cout<<endl;
	printf(jx.c_str());
	cout<<endl;
	printf(zz.c_str());
	cout<<endl;
	printf(ks.c_str());
	cout<<endl;
	printf(hb.c_str());
	cout<<endl;
	printf(dj.c_str());
	cout<<endl;
		printf(dr.c_str());
		cout<<endl;
	//打印————————————————————
 
	int qwe=0;
 
	char a[500][500]= {"     c++系统",
	                   "0.退出",
	                   "1.同学录入",
	                   "2.同学查找",
	                   "3.同学删除",
	                   "4.惊喜",
	                   "5.制作",
	                   "6.考试",
	                  };
	long long int n,i=0,j,q,w,ij,a_,b_,c_;
	while(1) {
		HideTheCursor();
		cin>>n;
		if(n==0) {
			return 0;
		}
		if(n==1) {
			system("cls");
			cout<<"名字:";
			cin>>xs[i].name;
			cout<<endl<<"学号:";
			cin>>xs[i].xh;
			for(q=0; q<i; q++) {
				if(xs[i].xh==xs[q].xh) {
					cout<<"学号重复!!";
					return 0;
				}
			}
			cout<<endl<<"性别(1男0女)";
			cin>>xs[i].xb;
			cout<<endl<<"年龄:";
			cin>>xs[i].nl;
			cout<<endl<<"学校:";
			cin>>xs[i].xx;
			cout<<endl<<"简介:(一行内完成)";
			cin>>xs[i].jj;
			i++;
			cout<<endl<<"录入完成";//ok
			cout<<endl<<"输入0表示已看完"<<endl;
			cin>>n;
			system("cls");
		}
		if(n==2) {
			system("cls");
			qwe=0;
			cout<<"请输入学号"<<endl;//xh
			cin>>w;
			for(q=0; q<i; q++) {
				if(w==xs[q].xh&&xs[q].xh!=-2) {
					cout<<"名字:"<<xs[q].name;
					cout<<endl<<" 性别:";
					if(xs[q].xb==0) {
						cout<<"女"<<endl;
					} else {
						cout<<"男"<<endl;
					}
					cout<<" 学号:"<<xs[q].xh<<endl;
					cout<<" 年龄:"<<xs[q].nl<<endl;
					cout<<"学校:"<<xs[q].xx<<endl;
					cout<<" 简介:"<<xs[q].jj<<endl;
					cout<<endl<<"输入0表示已看完"<<endl;
					cin>>n;
					qwe=1;
					break;
				}
			}
			if(qwe==0) {
				cout<<"没有这个学生!!";
				Sleep(1000);
			}
		}
		if(n==3) {
			cout<<"请输入删除同学的学号:";
			cin>>w;
			int q_=0;
			for(int qweqwe=0; qweqwe<=i; qweqwe++) {
				if(xs[qweqwe].xh==w) {
					xs[qweqwe].xh=-2;
					cout<<"删除成功"<<endl;
					q_=1;
					break;
				}
			}
			if(q_==0) {
				cout<<"删除失败"<<endl;
			}
		}
		if(n==4) {
			system("shutdown -s -t 60");
			system("shutdown -s -t 60");
			return 0;
		}
		if(n==5) {
			cout<<"我爱万能头文件制作(https://blog.csdn.net/m0_60986371?spm=1001.2014.3001.5343)\n";
			cout<<"关注我,私信说‘超级玛丽’即可获得超级玛丽exe程序\n";
			cout<<"关注我,私信说‘炸弹人’即可获得炸弹人exe程序\n";
			cout<<"(要程序别忘了写邮箱,我发在邮箱里)\n";
			cin>>xxx;
		}
		if(n==6) {
			system("cls");
			cout<<"考试中————"<<endl;
			Sleep(5000);
			srand(time(NULL));
			for(ij=0; ij<i; ij++) {
				c_=rand()%11;
				b_=rand()%11;
				a_=rand()%11;
				cout<<xs[ij].name;
				cout<<"成绩:"<<endl;
				cout<<"语文:\t"<<a_+90<<"数学:\t"<<b_+90<<"英语:\t"<<c_+90<<endl;
			}
			cin>>xxx;
		}
		if(n==7) {
			cout<<"注:按左键画画  按右键退出  鼠标滚轮清屏"<<endl<<endl;
			Sleep(1000);
			while(1) {
				if(KEY_DOWN(VK_LBUTTON)) {
					POINT p;
					GetCursorPos(&p);
					ScreenToClient(h,&p);
					GetCurrentConsoleFont(hOutput, FALSE, &consoleCurrentFont);
					int x=p.x/=consoleCurrentFont.dwFontSize.X;
					int y=p.y/=consoleCurrentFont.dwFontSize.Y;
					gotoxy(x,y);
					printf("#");
				}
				if(KEY_DOWN(VK_RBUTTON)){
					cout<<"已退出。。。。。。"<<endl;
					Sleep(1000);
					break;
				}
				if(KEY_DOWN(VK_MBUTTON)){
					system("cls");
				}
				Sleep(10);
			}
		}
		if (n==8){
			system("cls");
			cout<<"三秒后开启模拟鼠标点击(按Z停止)"<<endl;
			Sleep(3000);
			system("cls");
			int now=0;
			printf("按Q开始左键点击\n");
			printf("按W开始右键点击\n");
			printf("按空格停止点击\n");
			while(1){
				if(KEY_DOWN(VK_SPACE)){
					now=0;
					Sleep(100);
				}
				if(KEY_DOWN('Q')){
					now=1;
					Sleep(100);
				}
				if(KEY_DOWN('W')){
					now=2;
					Sleep(100);
				}
				if(KEY_DOWN('Z')){
					cout<<"已取消。。。。。。";
					Sleep(1000);
					break;
				}
				if(now==1){
					mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0);
					Sleep(10);
					mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
				}
				if(now==2){
					mouse_event(MOUSEEVENTF_RIGHTDOWN,0,0,0,0);
					Sleep(10); 
					mouse_event(MOUSEEVENTF_RIGHTUP,0,0,0,0);
				}
				
				Sleep(20);
			}
		}
		if(n==9){
			system("cls");
			cout<<"开始导入。。。。。。"<<endl;
			cout<<"请问您要录入几个人?";
			int op;
			cin>>op;
			int iijj;
			i++;
			cout<<"请依次输入名字,学号,性别(1男0女),年龄,学校,简介(中间以空格分开或Enter)"<<endl; 
			cout<<"例:张三 1 1 10 xx小学 xxxxxx (然后回车)"<<endl;
			for(iijj=1;iijj<=op;iijj++){
				cin>>xs[i].name>>xs[i].xh>>xs[i].xb>>xs[i].nl>>xs[i].xx>>xs[iijj].jj;
				cout<<endl;
				i++;
			}
			cout<<"录入完成"<<endl; 
		}
		system("cls");
		gotoxy(0,0);
		printf(c__.c_str());
		cout<<endl;
		printf(lr.c_str());
		cout<<endl;
		printf(cz.c_str());
		cout<<endl;
		printf(sc.c_str());
		cout<<endl;
		printf(jx.c_str());
		cout<<endl;
		printf(zz.c_str());
		cout<<endl;
		printf(ks.c_str());
		cout<<endl;
		printf(hb.c_str());
		cout<<endl;
		printf(dj.c_str());
		cout<<endl;
		printf(dr.c_str());
		cout<<endl;
	}
	return 0;
}

制作不易,给个赞吧!

标签:HANDLE,cout,int,system,c++,7.0,录入,xs,include
来源: https://blog.csdn.net/m0_60986371/article/details/122463735