Yam Code
Sign up
Login
New paste
Home
Trending
Archive
English
English
Tiếng Việt
भारत
Sign up
Login
New Paste
Browse
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #define max_hocsinh 20 int luachon; int sothanhvien; struct hocsinh { char ten[100]; int tuoi; char diachi[100]; } hs[max_hocsinh]; int i; int check; int map; void printfLoading(float progress) { int length = 50; printf("\t\t\t["); int pos = length * progress; for (int i = 0; i < length; ++i) { if (i < pos) printf("#"); else if (i == pos) printf(">"); else printf("."); system("clear"); } printf("] %d %%\r", (int)(progress * 100)); fflush(stdout); } void themthanhvien(int sothanhvien) { for(i = 1; i <= sothanhvien; i++) { printf("THANH VIEN THU[%d]\n", i); printf("nhap vao ten cua thanh vien thu %d : \n", i); scanf("%s", hs[i].ten); getchar(); while(1){ printf("nhap vao so tuoi cua thanh vien: \n"); scanf("%d", &hs[i].tuoi); if(hs[i].tuoi < 0 && hs[i].tuoi > 100) { printf("Nhap lai so tuoi (0 -100) :"); scanf("%d",&hs[i].tuoi); } else { break; } } printf("nhap vao dia chi cua thanh vien: \n"); scanf("%s", hs[i].diachi); } } void xemdanhsach(int sothanhvien) { check = sothanhvien; for(i = 1; i <= check; i++) { printf("\n\nTHANH VIEN THU [%d]: \n", i); printf("Ten: %s \n", hs[i].ten); printf("Tuoi: %d\n", hs[i].tuoi); printf("Dia chi: %s \n", hs[i].diachi); } } void tkthanhvien(int sothanhvien,char timthanhvien[100]) { for(i = 1; i <= sothanhvien; i++) { if(strcmp(hs[i].ten,timthanhvien) == 0) { printf("co %s trong danh sach thanh vien",timthanhvien); break; } } } void xoa(int vitri,int sothanhvien) { for (int i = vitri; i < sothanhvien - 1; i++) { hs[i] = hs[i + 1]; } sothanhvien--; printf("Da xoa thanh vien tai vi tri : %d\n",vitri+1); } void menu() { int sothanhvien; int vitri; char timthanhvien[100]; while(1){ printf("\n1. THEM THANH VIEN"); printf("\n2. XEM DANH SACH"); printf("\n3. TIM KIEM THANH VIEN"); printf("\n4. XOA THANH VIEN"); printf("\nnhap vao lua chon: "); scanf("%d", &luachon); switch(luachon) { case 1: printf("ban muon them bao nhieu thanh vien: "); scanf("%d", &sothanhvien); themthanhvien(sothanhvien); menu(); break; case 2: xemdanhsach(sothanhvien); menu(); break; case 3: printf("Nhap ten thanh vien can tim :\n"); scanf("%s",timthanhvien); tkthanhvien(sothanhvien,timthanhvien); menu(); break; case 4: while(1) { printf("nhap vi tri muon xoa trong mang: \n"); scanf("%d",&vitri); if(vitri == 0) { printf("Nhap sai vui long nhap lai!\n"); continue; } if(vitri < 0 || vitri > sothanhvien) { printf("dien vi tri sai , vui long thu lai\n"); continue; } if(vitri > 0) { break; } } xoa(vitri-1,sothanhvien); //mang bat dau tu 0 menu(); break; } if(luachon <=1 && luachon >= 4) { break; } } } int main() { printf("\n"); for (float p = 0.0; p <= 1.1; p += 0.1) { printfLoading(p); usleep(400000); } printf("\nChao mung ban den voi dao xanh da nang \n"); menu(); return 0; }
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
भारत