Advertisement
gacnvnmovie

Untitled

Dec 1st, 2014
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.63 KB | None | 0 0
  1. // bai1.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "stdio.h"
  6. #include "conio.h"
  7. #include "math.h"
  8. struct sinhvien
  9. {
  10.     char hoten[31];
  11.     int mssv;
  12.     char ngaysinh[14];
  13.     char lop[10];
  14.     char khoa[50];
  15. };
  16. typedef struct sinhvien SINHVIEN;
  17. void nhap(SINHVIEN &);
  18. void xuat(SINHVIEN);
  19. void nhap(SINHVIEN &x)
  20. {
  21.     printf("nhap ho ten: ");
  22.     gets (x.hoten);
  23.     printf("nhap ma so sinh vien: ");
  24.     scanf("%d",&x.mssv);
  25.     printf("nhap ngay sinh: ");
  26.     scanf("%s",&x.ngaysinh);
  27.     printf("nhap lop: ");
  28.     scanf("%s",&x.lop);
  29.     printf("nhap khoa: ");
  30.     scanf("%s",&x.khoa);
  31. }
  32. void xuat(SINHVIEN x)
  33. {
  34.     printf("\n ho ten: %s",x.hoten);
  35.     printf("\n ma so sinh vien: %d",x.mssv);
  36.     printf("\n ngay sinh: %s",x.ngaysinh);
  37.     printf("\n lop: %s",x.lop);
  38.     printf("\n khoa: %s",x.khoa);
  39.  
  40. }
  41. void main()
  42. {
  43.     SINHVIEN sv;
  44.     nhap(sv);
  45.     xuat(sv);
  46.     getch();
  47. }
  48.  
  49.  
  50.  
  51. ------------
  52. // bai2.cpp : Defines the entry point for the console application.
  53. //
  54.  
  55. #include "stdafx.h"
  56. #include "stdio.h"
  57. #include "conio.h"
  58. #include "math.h"
  59. struct diem
  60. {
  61.     int x,y;
  62. };
  63. typedef struct diem DIEM;
  64. struct tamgiac
  65. {
  66.     diem A,B,C;
  67. };
  68. typedef struct tamgiac TAMGIAC;
  69. void nhap(TAMGIAC &p)
  70. {
  71.     printf("nhap toa do A: ");
  72.     scanf("%d",&p.A.x);
  73.     scanf("%d",&p.A.y);
  74.     printf("nhap toa do B: ");
  75.     scanf("%d",&p.B.x);
  76.     scanf("%d",&p.B.y);
  77.     printf("nhap toa do C: ");
  78.     scanf("%d",&p.C.x);
  79.     scanf("%d",&p.C.y);
  80. }
  81. void xuat(TAMGIAC p)
  82. {
  83.     printf("\n A(%d;%d)",p.A.x,p.A.y);
  84.     printf("\n B(%d;%d)",p.B.x,p.B.y);
  85.     printf("\n C(%d;%d)",p.C.x,p.C.y);
  86. }
  87. void main()
  88. {
  89.     TAMGIAC tg;
  90.     nhap(tg);
  91.     xuat(tg);
  92.     getch();
  93. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement