[ create a new paste ] login | about

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

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

struct DaThuc
{
	float a[100];
	int n;
};
typedef struct DaThuc DATHUC;

void NhapDaThuc(DATHUC &);
void XuatDaThuc(DATHUC);

void NhapDaThuc(DATHUC &dt)
{
	printf("\nNhap bac da thuc: ");
	scanf("%d", &dt.n);
	for(int i = dt.n; i >= 0; i--)
	{
		float temp;
		printf("\nNhap he so: ");
		scanf("%f", &temp);
		dt.a[i] = temp;
	}
}

void XuatDaThuc(DATHUC dt)
{
	for(int i = dt.n; i >= 0; i--)
	{
		printf("%8.3fx^%d + ", dt.a[i], i);
	}
}

int main()
{
	DATHUC dt;
	NhapDaThuc(dt);
	XuatDaThuc(dt);

	getch();
	return 0;
}


Output:
1
2
3
4
5
Line 17: error: conio.h: No such file or directory
Line 11: error: expected ';', ',' or ')' before '&' token
Line 14: error: expected ';', ',' or ')' before '&' token
In function 'XuatDaThuc':
Line 29: error: 'for' loop initial declaration used outside C99 mode


Create a new paste based on this one


Comments: