You are on page 1of 1

BXT hieu.tu=a.tu*b.mau-a.mau*b.

tu; p[i] = p[j]; free(a); int timx(int a[], int n,int x)


hieu.mau=a.mau*b.mau; p[j] = temp; return 0; {
#include<iostream> rutgon(hieu); } } if(n==0)
#include<string.h> return hieu; } #include<iostream> return -1;
using namespace std; } cout<<"\nday phan so tang dan: "; using namespace std; if(a[n]==x)
typedef struct sinhvien PS nhan(PS a, PS b) for(int i=0;i<n;i++) void nhapmang(int *pa, int &n); return n;
{ { { void nhapmang(int *pa, int &n) return timx(a,n-1,x);
char mssv[10]; PS tich; cout<<p[i].tu<<"/"<<p[i].mau<<"\t"; { }
char hoten[50]; tich.tu=a.tu*b.tu; } int t; int main()
char gioitinh[2]; tich.mau=a.mau*b.mau; } cout<<"nhap n: ";cin>>n; {
char lop[7]; rutgon(tich); int main() for(int i=0;i<n;i++) int n,a[100],x;
float dtb; return tich; { { cout<<"nhap n: ";
}sv; } phanso p[100]; cout<<"nhap a["<<i<<"]: "; do{
void nhap1sv(sv &s) PS chia(PS a, PS b) int n; cin>>*(pa+i); cin>>n;
{ { nhapps(p,n); do{ if(n<5 || n>10)
fflush(stdin); PS thuong; xuatps(p,n); if(*(pa+i)%2!=0){ cout<<"nhap n 5-10: ";
cout<<"nhap mssv: "; thuong.tu=a.tu*b.mau; ps tong=tongps(p,n); cout<<"Nhap lai a["<<i<<"]: "; }while(n<5 || n>10);
gets(s.mssv); thuong.mau=a.mau*b.tu; cout<<"\ntong phan so cua day = cin>>*(pa+i); nhapmang(a,n);
cout<<"nhap ho ten: "; rutgon(thuong); "<<tong.tu<<"/"<<tong.mau; t=1;} cout<<"\nMANG VUA NHAP LA: ";
gets(s.hoten); return thuong; ps max=psmax(p,n); else t=0; xuatmang(a,n,1);
do{ } cout<<"\nphan so lon nhat = }while(t==1); cout<<"\ntong mang =
cout<<"nhap gioi tinh(x=nu-y=nam): int main() "<<max.tu<<"/"<<max.mau; } "<<tongmang(a,n);
"; { sapxep(p,n); } cout<<"\ntong chan =
gets(s.gioitinh); PS a,b,cong,hieu,tich,thuong; return 0; int tinhtong(int *pa, int n); "<<tongchan(a,n);
}while(!strstr(s.gioitinh,"x") && ! nhap(a); } int tinhtong(int *pa, int n) cout<<"\nso phan tu duong =
strstr(s.gioitinh,"y")); nhap(b); #include<iostream> { "<<sophantuduong(a,n,1);
cout<<"nhap lop: "; cout<<"phan so thu 1: ";xuat(a); #include<stdlib.h> int tong=0; cout<<"\nphan tu lon nhat =
gets(s.lop); cout<<"\nphan so thu 2: ";xuat(b); using namespace std; for(int i=0;i<n;i++) "<<timmax(a,n);
cout<<"nhap diem trung binh: "; cong=tong(a,b); void nhapmang(int **a, int m, int n) { cout<<"\nphan tu nho nhat =
cin>>s.dtb; cout<<"tong hai phan so = { tong+=*(pa+i); "<<timmin(a,n);
} ";xuat(cong); for(int i=0;i<m;i++) } if(chancuoi(a,n)==-1)
void xuat1sv(sv s) hieu=tru(a,b); { cout<<"tong ="<< tong<<"\n"; cout<<"\nmang kh co phan tu
{ cout<<"\nhieu hai phan so = for(int j=0;j<n;j++) } chan";
char chr='x'; ";xuat(hieu); { void nhapsochan(int *pa, int n); else
cout<<"\nMSSV: "<<s.mssv; tich=nhan(a,b); do void nhapsochan(int *pa, int n) cout<<"\nphan tu chan cuoi cung
cout<<"\nHO TEN: "<<s.hoten; cout<<"\ntich hai phan so = { { trong mang = "<<chancuoi(a,n);
if(strchr(s.gioitinh,chr)) ";xuat(tich); cout<<"a["<<i<<"]["<<j<<"]: "; for(int i=0;i<n;i++) cout<<"\nnhap x can tim: ";cin>>x;
cout<<"\nGIOI TINH: nu"; thuong=chia(a,b); cin>>*(*(a+i)+j); { if(timx(a,n,x)==-1)
else cout<<"\nthuong hai phan so = if(10000%*(*(a+i)+j)!=0) if(*(pa+i)%2!=0) cout<<"\nx khong co trong mang ";
cout<<"\nGIOI TINH: nam"; ";xuat(thuong); { cout<<*(pa+i)<<"\t"; else
cout<<"\nLOP: "<<s.lop; return 0; cout<<*(*(a+i)+j)<<" khong phai } cout<<"\nx nam o vi tri n =
cout<<"\nDIEM TRUNG BINH: #include<iostream> nghiem cua 10000\n"; } "<<timx(a,n,x);
"<<s.dtb<<"\n"; using namespace std; cout<<"NHAP LAI!!!\n"; int main() return 0;
} typedef struct phanso } { }
void nhapdssv(sv *a, int &n) { }while(10000%*(*(a+i)+j)!=0); int n, *pa; #include<string.h>
{ int tu; }}} pa = new int[0]; Hàm strlen – hàm lấy chiều dài chuỗi
cout<<"nhap so luong sinh vien: int mau; void xuatmang(int **a, int m,int n) nhapmang(pa,n); Hàm strcmp – hàm so sánh 2 chuỗi
";cin>>n; }ps; { tinhtong(pa,n); Hàm strcat – hàm nối chuỗi
for(int i=0;i<n;i++) void nhapps(ps p[], int &n) for(int i=0;i<m;i++) nhapsochan(pa,n); Hàm strcpy – hàm copy chuỗi
{ { { return 0; Hàm strlwr – Đưa chuỗi về dạng
cout<<"nhap sinh vien thu cout<<"nhap so luong phan so: for(int j=0;j<n;j++) } lowercase
"<<i+1<<"\n"; ";cin>>n; { Hàm strupr – đưa chuỗi về dạng
#include<iostream>
nhap1sv(*(a+i)); for(int i=0;i<n;i++) cout<<*(*(a+i)+j)<<"\t"; uppercase
using namespace std;
}} { } Hàm strrev – hàm đảo ngược chuỗi
void nhapmang(int a[], int n)
void xuatdssv(sv *a, int n) cout<<"nhap tu so thu "<<i+1<<": cout<<"\n"; Hàm strchr – Trả về vị trí đầu tiên
{
{ ";cin>>p[i].tu; }} của ký tự cần tìm
if(n==0)
for(int i=0;i<n;i++) do{ int tinhtong(int **a, int m, int n) Hàm strstr – hàm tìm chuỗi con
return;
{ cout<<"nhap mau so thu "<<i+1<<": { trong chuỗi
cout<<"nhap a["<<n<<"]: ";
cout<<"\nThong tin sinh vien thu ";cin>>p[i].mau; int tong=0; cin>>a[n]; #include<iostream>
"<<i+1<<"\n"; if(p[i].mau==0) for(int i=0;i<m;i++) nhapmang(a,n-1); #include<cstring>
xuat1sv(*(a+i)); cout<<"NHAP LAI!!!"; { } using namespace std;
}} }while(p[i].mau==0); for(int j=0;j<n;j++) void xuatmang(int a[], int n,int i) struct HocSinh{
int main() } { { char MaSo[11];
{ } tong+=*(*(a+i)+j); if(i>n) char HoTen[32];
sv a[100]; void xuatps(ps p[], int n) }} return; double Diem;
int n; { cout<<"\ntong cac phan tu = cout<<a[i]<<"\t"; char HocLuc[3];
//nhap1sv(s); for(int i=0;i<n;i++) "<<tong; xuatmang(a,n,i+1); };
//xuat1sv(s); { } } typedef struct HocSinh hs;
nhapdssv(a,n); cout<<"\nphan so thu "<<i+1<<": int timmax(int **a, int m, int n) int tongmang(int a[], int n) void GetInf (hs *a, int &n){
xuatdssv(a,n); "<<p[i].tu<<"/"<<p[i].mau; { { fflush(stdin);
return 0; } int max=*(*(a+0)+0); if(n==0) cout<<"Nhap so luong hoc
} } for(int i=0;i<m;i++) return 0; sinh:";cin>>n;
#include<iostream> int ucln(int a, int b) { return a[n]+tongmang(a,n-1); for(int i=0; i<n; i++){
using namespace std; { for(int j=0;j<n;j++) } cout<<"a["<<i<<"]:"<<endl;
typedef struct phanso int r; { int tongchan(int a[], int n) cout<<"Ma so:";cin>>gets(a->MaSo);
{ while (a%b!=0) if(*(*(a+i)+j)>max) { cout<<"Ho va ten:";cin>>gets(a-
int tu; { max=*(*(a+i)+j); if(n<=0) >HoTen);
int mau; r=a%b; } return 0; do{
}PS; a=b; } if(a[n]%2==0) cout<<"Diem:";cin>>a->Diem;
void nhap(PS &x) b=r; cout<<"\nso lon nhat = "<<max; return a[n] + tongchan(a,n-1); }while(a->Diem>=10.0 &&a-
{ } } return tongchan(a,n-1); >Diem<=5.0);fflush(stdin);
cout<<"nhap tu : ";cin>>x.tu; return b; void vitrisole(int **a, int m, int n) } do{
cout<<"nhap mau : ";cin>>x.mau; } { int sophantuduong(int a[], int n,int cout<<"Hoc Luc:";gets(a->HocLuc);
} ps tongps(ps p[], int n) for(int i=0;i<m;i++) dem) }while(!strstr(a->HocLuc,"G")&&!
void xuat(PS x) { { { strstr(a->HocLuc,"K")&&!strstr(a-
{ ps tmp=p[0]; for(int j=0;j<n;j++) if(n==0) >HocLuc,"TB"));
cout<<x.tu<<"/"<<x.mau; for(int i=1;i<n;i++) { return 0; }
} { if(*(*(a+i)+j)%2!=0) if(a[n]>0) }
int UCLN(int a, int b) tmp.tu=tmp.tu*p[i].mau+tmp.mau* cout<<"a["<<i<<"]["<<j<<"]\n"; return dem+sophantuduong(a,n- void dis (hs *a, int n){
{ p[i].tu; } 1,dem); cout<<"Danh sach hoc sinh vua nhap
while(a!=b) tmp.mau=tmp.mau*p[i].mau; } return sophantuduong(a,n-1,dem); -----"<<endl;
{ int u=ucln(tmp.tu,tmp.mau); } } for(int i =0; i<n; i++)
if(a>b) tmp.tu/=u; int main() int timmax(int a[], int n) {
a-=b; tmp.mau/=u; { { cout<<a->MaSo<<endl; (*a).MaSo
else } int m,n,i; if(n==1) cout<<a->HoTen<<endl;
b-=a; return tmp; cout<<"nhap so dong: ";cin>>m; return a[n]; cout<<a->Diem<<endl;
} } cout<<"nhap so cot: ";cin>>n; if(a[n]>timmax(a,n-1)) cout<<a->HocLuc;
return a; ps psmax(ps p[], int n) int **a=new int*[m]; return a[n]; }
} { for(i=0;i<m;i++) return timmax(a,n-1); }
PS rutgon(PS &x) ps max=p[0]; { } int main ()
{ for(int i=1;i<n;i++) a[i]=new int [n]; int timmin(int a[], int n) {
int u=UCLN(x.tu,x.mau); { } { hs a[100];
x.tu/=u; if(max.tu*p[i].mau<max.mau*p[i].t // a = (int **) malloc (m * if(n==1) int n;
x.mau/=u; u) sizeof(int *)); return a[1]; GetInf(a,n);
return x; max=p[i]; // for (i = 0; i < m; i++) if(a[n]<timmin(a,n-1)) dis(a,n);
} } // { return a[n]; return 0;
PS tong(PS a, PS b) return max; // // C?p phát cho t?ng con tr? else }
{ } c?p 1 return timmin(a,n-1);
PS tong; void sapxep(ps p[], int n) // a[i] = (int *)malloc(n * }
tong.tu=a.tu*b.mau+a.mau*b.tu; { sizeof(int)); int chancuoi(int a[], int n)
tong.mau=a.mau*b.mau; ps temp; // } {
rutgon(tong); for(int i=0;i<n-1;i++) nhapmang(a,m,n); if(n<=0)
return tong; { xuatmang(a,m,n); return -1;
} for(int j=1;j<n;j++) tinhtong(a,m,n); if(a[n]%2==0)
PS tru(PS a, PS b) if(p[i].tu*p[j].mau>p[j].tu*p[i].mau) timmax(a,m,n); return a[n];
{ { cout<<"\ncac vi tri so le la: \n"; return chancuoi(a,n-1);
PS hieu; temp = p[i]; vitrisole(a,m,n); }

You might also like