[ create a new paste ] login | about

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

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

struct Diem
{
	float x;
	float y;
};
typedef struct Diem DIEM;

void NhapDiem(DIEM &);
void XuatDiem(DIEM);

struct DuongTron
{
	DIEM I;
	float R;
};
typedef struct DuongTron DUONGTRON;

void NhapDuongTron(DUONGTRON &);
void XuatDuongTron(DUONGTRON);

void NhapDiem(DIEM &d)
{
	float temp;
	printf("\nNhap x: ");
	scanf("%f", &temp);
	d.x = temp;

	printf("\nNhap y: ");
	scanf("%f", &temp);
	d.y = temp;
}

void XuatDiem(DIEM d)
{
	printf("(%8.3f, %8.3f)" , d.x, d.y);
}

void NhapDuongTron(DUONGTRON &dt)
{
	float temp;
	NhapDiem(dt.I);
	printf("\nNhap ban kinh: ");
	scanf("%f", &temp);
	dt.R = temp;
}

void XuatDuongTron(DUONGTRON dt)
{
	printf("((%8.3f, %8.3f), %8.3f)", dt.I.x, dt.I.y, dt.R);
}

int main()
{
	DIEM d;
	DUONGTRON dt;
	NhapDuongTron(dt);
	XuatDuongTron(dt);
	getch();
	return 0;
}


Output:
1
2
3
4
5
Line 17: error: conio.h: No such file or directory
Line 12: error: expected ';', ',' or ')' before '&' token
Line 22: error: expected ';', ',' or ')' before '&' token
Line 25: error: expected ';', ',' or ')' before '&' token
Line 42: error: expected ';', ',' or ')' before '&' token


Create a new paste based on this one


Comments: