Yam Code
Sign up
Login
New paste
Home
Trending
Archive
English
English
Tiếng Việt
भारत
Sign up
Login
New Paste
Browse
#include <iostream> #include <iomanip.h> #include <conio.h> using namespace std; struct DATE { int ng,th,nam; }; class PHIEU { protected: char sp[10]; DATE nl; float tkn,tkc; public: void Nhap() { fflush(stdin); cout<<"Nhap so phieu: ";cin.getline(sp,10); cout<<"Nhap ngay lap: ";cin>>nl.ng>>nl.th>>nl.nam; cout<<"Nhap tai khoan no: ";cin>>tkn; cout<<"Nhap tai khoan co: ";cin>>tkc; } void Xuat() { cout<<setiosflags(ios::left)<<setw(10)<<sp; if(nl.ng>9)cout<<nl.ng<<"-";else cout<<"0"<<nl.ng<<"-"; if(nl.th>9)cout<<nl.th<<"-";else cout<<"0"<<nl.th<<"-"; cout<<setiosflags(ios::left)<<setw(8)<<nl.nam; cout<<setiosflags(ios::left)<<setw(20)<<tkn; cout<<setiosflags(ios::left)<<setw(20)<<tkc; } DATE getnl() { return nl; } }; class PHIEUTHU: public PHIEU { private: char ht[30]; char dc[50]; char ld[50]; float st; public: void Nhap() { PHIEU::Nhap(); fflush(stdin); cout<<"Nhap ho ten nguoi nop: ";cin.getline(ht,30); fflush(stdin); cout<<"Nhap dia chi: ";cin.getline(dc,50); fflush(stdin); cout<<"Nhap ly do: ";cin.getline(ld,50); cout<<"Nhap so tien: ";cin>>st; } void Xuat() { PHIEU::Xuat(); cout<<setiosflags(ios::left)<<setw(30)<<ht; cout<<setiosflags(ios::left)<<setw(30)<<dc; cout<<setiosflags(ios::left)<<setw(20)<<ld; cout<<st; } friend bool operator<(PHIEUTHU &a, const float b) { return(a.st<b); } float getst() { return st; } }; class PHIEUXUAT: public PHIEU { private: char ht[30]; char ld[50]; char xtk[50]; float st; public: void Nhap() { PHIEU::Nhap(); fflush(stdin); cout<<"Nhap ho ten nguoi nhan: ";cin.getline(ht,30); fflush(stdin); cout<<"Nhap ly do xuat: ";cin.getline(ld,50); fflush(stdin); cout<<"Xuat tai kho: ";cin.getline(xtk,50); cout<<"Nhap so tien: ";cin>>st; } void Xuat() { PHIEU::Xuat(); cout<<setiosflags(ios::left)<<setw(30)<<ht; cout<<setiosflags(ios::left)<<setw(30)<<ld; cout<<setiosflags(ios::left)<<setw(20)<<xtk; cout<<st; } friend bool operator>(PHIEUXUAT &a, const float b) { return(a.st>b); } friend bool operator==(PHIEUXUAT &a, char kho[50]) { return(strcmpi(a.xtk,kho)==0); } }; int main() { PHIEUTHU *a; PHIEUXUAT *b; int i,n1,n2; float tongtien=0; cout<<"Nhap so luong phieu xuat: ";cin>>n1; a=new PHIEUTHU[n1]; cout<<"\n\n\tNHAP THONG TIN PHIEU THU"; cout<<"\n------------------------------------------\n"; for(i=0;i<n1;i++) { cout<<"\n\n\tNhap thong tin phieu thu thu "<<i+1<<endl<<endl; a[i].Nhap(); } cout<<"\n------------------------------------------\n\n\n"; cout<<"Nhap so luong phieu xuat: ";cin>>n2; b=new PHIEUXUAT[n2]; cout<<"\n\n\tNHAP THONG TIN PHIEU XUAT"; cout<<"\n------------------------------------------\n"; for(i=0;i<n2;i++) { cout<<"\n\n\tNhap thong tin phieu xuat thu "<<i+1<<endl<<endl; b[i].Nhap(); } cout<<"\n------------------------------------------\n\n\n"; //============================================ cout<<"\n\nTong so phieu da lap la: "<<n1+n2<<"\n\n\n"; //============================================ cout<<"\t\t\t\t\tDANH SACH THONG TIN PHIEU THU VAT TU TRONG THANG 1 NAM 2021 CO SO TIEN NHO HON 10TR"<<"\n\n\n"; cout<<"\n--------------------------------------------------------------------------------------------------------------------------------------------------------\n"; cout<<setiosflags(ios::left)<<setw(10)<<"So phieu"; cout<<setiosflags(ios::left)<<setw(14)<<"Ngay lap"; cout<<setiosflags(ios::left)<<setw(20)<<"Tai khoan no"; cout<<setiosflags(ios::left)<<setw(20)<<"Tai khoan co"; cout<<setiosflags(ios::left)<<setw(30)<<"Ho ten nguoi Nhan"; cout<<setiosflags(ios::left)<<setw(30)<<"Dia chi"; cout<<setiosflags(ios::left)<<setw(20)<<"Ly do"; cout<<setiosflags(ios::left)<<setw(20)<<"So tien"; cout<<"\n--------------------------------------------------------------------------------------------------------------------------------------------------------\n"; for(i=0;i<n1;i++) { if(a[i].getnl().th==1 && a[i].getnl().nam==2021 && a[i]<10000000) { a[i].Xuat(); cout<<endl; } } cout<<"\n--------------------------------------------------------------------------------------------------------------------------------------------------------\n\n\n"; //============================================ cout<<"\t\t\t\t\tDANH SACH THONG TIN PHIEU XUAT CO SO TIEN LON HON 5 TR"<<"\n\n\n"; cout<<"\n--------------------------------------------------------------------------------------------------------------------------------------------------------\n"; cout<<setiosflags(ios::left)<<setw(10)<<"So phieu"; cout<<setiosflags(ios::left)<<setw(14)<<"Ngay lap"; cout<<setiosflags(ios::left)<<setw(20)<<"Tai khoan no"; cout<<setiosflags(ios::left)<<setw(20)<<"Tai khoan co"; cout<<setiosflags(ios::left)<<setw(30)<<"Ho ten nguoi Nhan"; cout<<setiosflags(ios::left)<<setw(30)<<"Ly do xuat kho"; cout<<setiosflags(ios::left)<<setw(20)<<"Xuat tai kho"; cout<<setiosflags(ios::left)<<setw(20)<<"So tien"; cout<<"\n--------------------------------------------------------------------------------------------------------------------------------------------------------\n"; for(i=0;i<n2;i++) { if(b[i]>5000000 && b[i]=="KHO03") { b[i].Xuat(); cout<<endl; } } cout<<"\n--------------------------------------------------------------------------------------------------------------------------------------------------------\n\n\n"; //============================================ for(i=0;i<n1;i++) { if(a[i].getnl().ng<=15 && a[i].getnl().th==3 && a[i].getnl().nam==2021) tongtien+=a[i].getst(); } cout<<"Tong tien thu trong nua dau thang 3 nam 2021 la: "<<tongtien<<endl; 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
भारत