[dslk]luongNV
// [dslk]luongNV.cpp : Defines the entry point for the console application.
#include "stdafx.h"
struct nv
{
char HoTen[30];
char ngaysinh[15];
long mucluong;
};
struct nodelist
{
nv data;
nodelist *pNext;
};
struct list
{
nodelist *pHead;
nodelist *pTail;
};
void Init(list &l)
{
l.pHead = l.pTail= NULL;
}
nodelist *GetNode(int x)
{
nodelist *p=new nodelist;
if(p==NULL)
return NULL;
p->info=x;
p->pNext=NULL;
return p;
}
void AddHead(list &l, nodelist*p)
{
if(l.pHead==NULL)
l.pHead=l.pTail=p;
else
{
p->pNext=l.pHead;
l.pHead=p;
}
}
void ReadFile(list &l)
{
//int a[100];
FILE *f = fopen("input.txt","rt");
while(!feof(f))
{
fscanf(f,"%d",&temp);
nodelist *p= GetNode(temp);
AddHead(l,p);
//AddTail(l,p);
}
fclose(f);
}
void printLuong(list l)
{
for(nodelist *p =l.pHead;p;p=p->pNext)
if(p->data.mucluong>3000000)
printf("%s0",p->data.HoTen);
}
int _tmain(int argc, _TCHAR* argv[])
{
list l;
Init(l);
AddHead(l,p);
ReadFile(l);
PrintLuong(l);
return 0;
}
Bạn đang đọc truyện trên: AzTruyen.Top