Yam Code
Sign up
Login
New paste
Home
Trending
Archive
English
English
Tiếng Việt
भारत
Sign up
Login
New Paste
Browse
#include"console.h" #include<iostream> #include<conio.h> #include<string> using namespace std; /* TÀI KHOẢNG CỦA GIÁO VIÊN / HỌC SINH */ #define TEACHER_USERNAME "trucvy" #define TEACHER_PASSWORD "abc123!" #define STUDENT_USERNAME "dinhhuukien" #define STUDENT_PASSWORD "abc123!" typedef struct Student { string MSSV; string Ho; string Lot; string Ten; string hoTen = Ho + Lot + Ten; float ANHVAN, GDTC, NMLT, PLDC, TCC, TH_NMLT, TH_PCMT, THUD, VLDC; }; typedef struct StudentNode { Student student; StudentNode *next; }; typedef struct StudentList{ StudentNode *head; StudentNode *tail; }; void modifyStudent(Student &sd1, Student &sd2) { sd1.hoTen = sd2.hoTen; } void printStudentList(StudentList &l) { StudentNode *p = l.head; cout << "Ma so sinh vien: Ten Sinh vien:"<<endl; while (p != NULL) { cout << p->student.MSSV << " " << p->student.hoTen << endl; p = p->next; } } StudentNode *getStudentNode(Student sd) { StudentNode *p = new StudentNode; if (p == NULL) { cout << "Khong du bo nho"; exit(NULL); } p->student.MSSV = sd.MSSV; p->student.Ho = sd.Ho; p->student.Lot = sd.Lot; p->student.Ten = sd.Ten; p->student.hoTen = sd.Ho +" "+ sd.Lot +" "+ sd.Ten; p->next = NULL; return p; } void insertHead(StudentList &l, Student sd) { StudentNode *p = getStudentNode(sd); if (p == NULL){ cout << "Sai du lieu"; exit(NULL); } if (l.head == NULL) l.head = l.tail = p; else { p->next = l.head; l.head = p; } } string getClientPerm() { appMenu(); int clientAnswer; cout << " DANG NHAP VOI QUYEN HAN LA \n" << endl; cout << " 1. Giao vien (Teacher)\n 2. Sinh vien (Student)\n 3. Thoat chuong trinh\n -> ";; cin >> clientAnswer; switch (clientAnswer) { case 1: return "teacher"; break; case 2: return "student"; break; default: exit(NULL); break; } } void loadStudentToList(StudentList &l, char *fileName) { Student sd; StudentNode *p = l.head; char MSSV[50]; char Ho[50]; char Lot[50]; char Ten[50]; FILE *f; f = fopen(fileName, "r"); if (f == NULL) { cout << "Khong tim thay du lieu"; exit(NULL); } for (int i = 0; i < 275; i++) { fscanf(f, "%s", &MSSV); fseek(f, 10, SEEK_SET); fscanf(f, "%s %s %s", &Ho, &Lot, &Ten); sd.MSSV = string(MSSV); sd.Ho = string(Ho); sd.Lot = string(Lot); sd.Ten = string(Ten); insertHead(l, sd); } fclose(f); } void appMenu(){ cout << "= = = = = = = = = = = = = = = = = = = = = = = = " << endl; cout << "= = " << endl; cout << "= CHUONG TRINH QUAN LY HOC SINH/SINH VIEN = " << endl; cout << "= ( STUDENTS MANAGEMENT SYSTEM ) = " << endl; cout << "= = " << endl; cout << "= = = = = = = = = = = = = = = = = = = = = = = = " << endl; cout << endl << endl; } bool isTeacherAccount() { string password; string username; clrscr(); appMenu(); cout << " DANG NHAP TAI KHOANG \n" << endl; do { fflush(stdin); cout << "\n [*] Nhap tai khoang Giao Vien:\n ->"; getline(cin, username); cout << "\n [*] Nhap mat khau Giao Vien:\n ->"; getline(cin, password); if (password != TEACHER_PASSWORD || username != TEACHER_USERNAME) { cout << "\nTai khoang hoac Mat Khau da nhap khong chinh xac" << endl; cout << "An ESC de tro lai. An bat ky de Dang Nhap lai"; } else return true; } while (_getch() != 27); return false; } void main() { //int clientAnswer; //appMenu(); //cout << " NHAP SO DE CHON TINH NANG TUONG UNG\n" << endl; //cout << " 1. Dang nhap\n 2. Thoat chuong trinh\n -> "; //cin >> clientAnswer; // //switch (clientAnswer) { // case 1: // clrscr(); // break; // case 2: // exit(NULL); // break; // default: // clrscr(); // main(); // break; //} //if ("teacher" == getClientPerm()) // if (isTeacherAccount()) { // cout << "Dang nhap Thanh Cong, chuyen den giao dien Quan Ly"; // Sleep(1000); // clrscr(); // } //else // clrscr(); StudentList l; l.head = l.tail = NULL; char *fileName = "mssv_hoten.txt"; loadStudentToList(l, fileName); printStudentList(l); _getch(); }
Paste Settings
Paste Title :
[Optional]
Paste Folder :
[Optional]
Select
Syntax Highlighting :
[Optional]
Select
Markup
CSS
JavaScript
Bash
C
C#
C++
Java
JSON
Lua
Plaintext
C-like
ABAP
ActionScript
Ada
Apache Configuration
APL
AppleScript
Arduino
ARFF
AsciiDoc
6502 Assembly
ASP.NET (C#)
AutoHotKey
AutoIt
Basic
Batch
Bison
Brainfuck
Bro
CoffeeScript
Clojure
Crystal
Content-Security-Policy
CSS Extras
D
Dart
Diff
Django/Jinja2
Docker
Eiffel
Elixir
Elm
ERB
Erlang
F#
Flow
Fortran
GEDCOM
Gherkin
Git
GLSL
GameMaker Language
Go
GraphQL
Groovy
Haml
Handlebars
Haskell
Haxe
HTTP
HTTP Public-Key-Pins
HTTP Strict-Transport-Security
IchigoJam
Icon
Inform 7
INI
IO
J
Jolie
Julia
Keyman
Kotlin
LaTeX
Less
Liquid
Lisp
LiveScript
LOLCODE
Makefile
Markdown
Markup templating
MATLAB
MEL
Mizar
Monkey
N4JS
NASM
nginx
Nim
Nix
NSIS
Objective-C
OCaml
OpenCL
Oz
PARI/GP
Parser
Pascal
Perl
PHP
PHP Extras
PL/SQL
PowerShell
Processing
Prolog
.properties
Protocol Buffers
Pug
Puppet
Pure
Python
Q (kdb+ database)
Qore
R
React JSX
React TSX
Ren'py
Reason
reST (reStructuredText)
Rip
Roboconf
Ruby
Rust
SAS
Sass (Sass)
Sass (Scss)
Scala
Scheme
Smalltalk
Smarty
SQL
Soy (Closure Template)
Stylus
Swift
TAP
Tcl
Textile
Template Toolkit 2
Twig
TypeScript
VB.Net
Velocity
Verilog
VHDL
vim
Visual Basic
WebAssembly
Wiki markup
Xeora
Xojo (REALbasic)
XQuery
YAML
HTML
Paste Expiration :
[Optional]
Never
Self Destroy
10 Minutes
1 Hour
1 Day
1 Week
2 Weeks
1 Month
6 Months
1 Year
Paste Status :
[Optional]
Public
Unlisted
Private (members only)
Password :
[Optional]
Description:
[Optional]
Tags:
[Optional]
Encrypt Paste
(
?
)
Create New Paste
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login
Site Languages
×
English
Tiếng Việt
भारत