[ create a new paste ] login | about

Link: http://codepad.org/S0NlRlTg    [ raw code | output | fork ]

C, pasted on Dec 23:
#include<stdio.h>
#include<conio.h>

 struct Gio 
{
	int Hour, Minute, Second;
};
typedef struct Gio GIO;

struct Ngay
{
       int Day, Month, Year;
};
typedef Ngay NGAY;

struct ChuyenBay 
{
	char Ma[5], NoiDi[20], NoiDen[20];
	Ngay NgayBay;
	Gio GioBay;
};
typedef struct ChuyenBay CHUYENBAY;


void NhapGio(GIO &g)
{
	printf("\nNhap gio: ");
	scanf("%d", &g.Hour);

	printf("\nNhap phut: ");
	scanf("%d", &g.Minute);

	printf("\nNhap giay: ");
	scanf("%d", &g.Second);
}
void XuatGio(GIO g)
{
	printf("%d:%d:%d", g.Hour, g.Minute, g.Second);
}

void NhapNgay(NGAY &ng)
{
	printf("\nNhap ngay: ");
	scanf("%d", &ng.Day);

	printf("\nNhap thang: ");
	scanf("%d", &ng.Month);

	printf("\nNhap nam: ");
	scanf("%d", &ng.Year);
}
void XuatNgay(NGAY ng)
{
	printf("%d-%d-%d", ng.Day, ng.Month, ng.Year);
}

void NhapChuyenBay(CHUYENBAY &cb)
{
	fflush(stdin);
	printf("\nNhap vao ma chuyen bay: ");
	gets(cb.Ma);

	fflush(stdin);
	printf("\nNhap noi di: ");
	gets(cb.NoiDi);

	fflush(stdin);
	printf("\nNhap noi den: ");
	gets(cb.NoiDen);

	printf("\nNhap vao ngay bay: ");
	NhapNgay(cb.NgayBay);

	printf("\nNhap vao gio bay: ");
	NhapGio(cb.GioBay);

}
void XuatChuyenBay(CHUYENBAY cb)
{
	printf("\nMa chuyen bay: %s", cb.Ma);
	printf("\nNoi di: %s", cb.NoiDi);
	printf("\nNoi den: %s", cb.NoiDen);
	printf("\nNgay bay: ");
	XuatNgay(cb.NgayBay);
	printf("\nGio bay: ");
	XuatGio(cb.GioBay);

}
int main()
{
	CHUYENBAY cb;
	NhapChuyenBay(cb);
	XuatChuyenBay(cb);

	getch();
	return 0;
}


Output:
1
2
3
4
5
6
7
8
9
10
Line 17: error: conio.h: No such file or directory
Line 15: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'NGAY'
Line 20: error: expected specifier-qualifier-list before 'Ngay'
Line 26: error: expected ';', ',' or ')' before '&' token
Line 42: error: expected ')' before '&' token
Line 53: error: expected ')' before 'ng'
Line 58: error: expected ';', ',' or ')' before '&' token
In function 'XuatChuyenBay':
Line 85: error: 'CHUYENBAY' has no member named 'NgayBay'
Line 87: error: 'CHUYENBAY' has no member named 'GioBay'


Create a new paste based on this one


Comments: