Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // bai1.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include "stdio.h"
- #include "conio.h"
- #include "math.h"
- struct sinhvien
- {
- char hoten[31];
- int mssv;
- char ngaysinh[14];
- char lop[10];
- char khoa[50];
- };
- typedef struct sinhvien SINHVIEN;
- void nhap(SINHVIEN &);
- void xuat(SINHVIEN);
- void nhap(SINHVIEN &x)
- {
- printf("nhap ho ten: ");
- gets (x.hoten);
- printf("nhap ma so sinh vien: ");
- scanf("%d",&x.mssv);
- printf("nhap ngay sinh: ");
- scanf("%s",&x.ngaysinh);
- printf("nhap lop: ");
- scanf("%s",&x.lop);
- printf("nhap khoa: ");
- scanf("%s",&x.khoa);
- }
- void xuat(SINHVIEN x)
- {
- printf("\n ho ten: %s",x.hoten);
- printf("\n ma so sinh vien: %d",x.mssv);
- printf("\n ngay sinh: %s",x.ngaysinh);
- printf("\n lop: %s",x.lop);
- printf("\n khoa: %s",x.khoa);
- }
- void main()
- {
- SINHVIEN sv;
- nhap(sv);
- xuat(sv);
- getch();
- }
- ------------
- // bai2.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include "stdio.h"
- #include "conio.h"
- #include "math.h"
- struct diem
- {
- int x,y;
- };
- typedef struct diem DIEM;
- struct tamgiac
- {
- diem A,B,C;
- };
- typedef struct tamgiac TAMGIAC;
- void nhap(TAMGIAC &p)
- {
- printf("nhap toa do A: ");
- scanf("%d",&p.A.x);
- scanf("%d",&p.A.y);
- printf("nhap toa do B: ");
- scanf("%d",&p.B.x);
- scanf("%d",&p.B.y);
- printf("nhap toa do C: ");
- scanf("%d",&p.C.x);
- scanf("%d",&p.C.y);
- }
- void xuat(TAMGIAC p)
- {
- printf("\n A(%d;%d)",p.A.x,p.A.y);
- printf("\n B(%d;%d)",p.B.x,p.B.y);
- printf("\n C(%d;%d)",p.C.x,p.C.y);
- }
- void main()
- {
- TAMGIAC tg;
- nhap(tg);
- xuat(tg);
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement