本文整理汇总了C++中InitList函数的典型用法代码示例。如果您正苦于以下问题:C++ InitList函数的具体用法?C++ InitList怎么用?C++ InitList使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了InitList函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
int i;
InitList(&filelist);
if (argc == 1)
copyfile(stdin);
else
{
for (i = 1; i < argc; i++)
addfile(argv[i]);
WalkList(&filelist, (WordFnPtr)putfile, 0);
}
return 0;
}
示例2: initFunction
//inicializace pole funkci
tChyba initFunction()
{
funcSize = 10;
currFuncSize = 0;
func = (TFunction*)malloc(sizeof(TFunction)*funcSize);
if( !func ){
return S_INTERNI_CHYBA;
}
for (int i = 0; i < funcSize; ++i){
func[i].key = NULL;
InitList( &(func[i].instrList) );
func[i].table = NULL;
}
return S_BEZ_CHYB;
}
示例3: InitHashTable
void InitHashTable(hashTablePrivate **htptr, int M,
int valueSize, void (*print)(), double (*equal)(),
unsigned long long int (*hashFun)(), void (*destroyValue)()) {
*htptr = malloc(sizeof(hashTablePrivate));
hashTablePrivate *ht = *htptr;
ht->table = malloc(sizeof(List)*M);
int i;
for (i = 0; i < M; ++i) {
InitList(&ht->table[i], valueSize, print, equal, destroyValue);
}
ht->hashFun = hashFun;
ht->M = M;
ht->size=0;
}
示例4: main
int main()
{ DLinkList *L;
int choice;
InitList(L);
int length;
ElemType *a;
length = readInput(a);
CreateList(L , a ,length);
DispList(L);
while(1 == scanf("%d",&choice))
{ LocateNode(L,choice);
DispList(L);
}
return 0;
}
示例5: CreatPolyn
Status CreatPolyn(polynomail *p, int m) {
int i, expn;
double coef;
ElemType e;
Link *s;
if (InitList(p) == ERROR)return ERROR;
for (i = 0; i < m; i++) {
printf("请输入第%d项的系数和指数:", i + 1);
scanf("%lf%d", &coef, &expn);
if (SetPolyn(&e, coef, expn) == ERROR)return ERROR; //输入数据,形成数据域
if (MakeNode(&s, e) == ERROR)return ERROR; //包装进一个结点
if (Append(p, s) == ERROR)return ERROR; //将结点插入链表尾
}
SortPolyn(p); //再慢慢排序
return OK;
}
示例6: Update
void CDashArrayDlg::OnBnClickedButtonrmv()
{
if ( m_pDashArray == NULL )
{
return;
}
Update();
if( m_iIndex == 1 )
{
::MessageBox(AfxGetApp()->GetMainWnd()->m_hWnd , "数组个数最少为1!" , "警告" ,MB_OK);
return;
}
m_pDashArray->RemoveDash( m_iIndex - 1 );
m_pDashArray->SetDashGroupCount(m_pDashArray->GetDashGroupCount() - 1);
InitList();
}
示例7: Algo10_11_main
void Algo10_11_main()
{
RedType d[N]={{278,1},{109,2},{63,3},{930,4},{589,5},{184,6},{505,7},{269,8},{8,9},{83,10}};
SLList l;
int *adr;
InitList(l,d,N);
printf("排序前(next域还没赋值):\n");
print(l);
RadixSort(l);
printf("排序后(静态链表):\n");
print(l);
adr=(int*)malloc((l.recnum)*sizeof(int));
Sort(l,adr);
Rearrange(l,adr);
printf("排序后(重排记录):\n");
print(l);
}
示例8: main
int main()
{
LinkList L;
InitList(&L);
Link test=NULL;
ElemType array[10] = {10,9,8,7,6,5,4,3,2,1};
/*ElemType array[10] = {0,9,8,7,6,5,4,3,2,1};*/
CreateListByArray(array,sizeof(array)/sizeof(ElemType),&L,&InsFirst);
printf("Length= %d\n",ListLength(L));
LocatePos(L,9,&test);
printf("第9个节点数据为%d\n",test->data) ;
printf("%s\n","------------------------------------") ;
ListTraverse(L,&Myvist);
DestroyList(&L);
return 0;
}
示例9: AddToMap
int AddToMap(Map* mp, char* key, void* value) {
if (!mp) return 0;
List* ls = FindInHashTable(mp->tb,key);
if (!ls) {
ls = InitList();
if (!InsertIntoHashTable(mp->tb,key,ls)) {
printf("Warning(Map): cannot insert %s into hash table!\n",key);
return 0;
}
mp->size++;
}
if (!AppendToList(ls,value)) {
printf("Warning(Map): cannot append to list!\n");
return 0;
}
return 1;
}
示例10: Test1
void Test1()//PushBack PopBack
{
PSListNode pHead = NULL;
InitList(&pHead);
PushBack(&pHead,0);
PushBack(&pHead,1);
PushBack(&pHead,2);
PushBack(&pHead,3);
PushBack(&pHead,4);
PrintList(&pHead);
PopBack(&pHead);
PopBack(&pHead);
PrintList(&pHead);
}
示例11: InitTimeCtrl
void CCardopenConsumeView::OnInitialUpdate()
{
CIBAFormView::OnInitialUpdate();
m_STATICResult.SetFont(&m_Font);
m_STATICResult.SetWindowText(_T(""));
InitTimeCtrl();
InitDate();
InitList();
GetDlgItem(IDC_BUTTON_QUERY)->SetFocus();
// 2011/12/28-8236-gxx: 自动查询一次
OnBnClickedButtonQuery();
}
示例12: CreateListByTail
/********************************************************************
Method: CreateListByTail
Parameter: 单链表,元素个数
Returns:
Purpose: 尾插法建立单链表
*********************************************************************/
bool CreateListByTail(LinkList &L, int num)
{
InitList(L);
Node *tail = L;
for (int i = 0; i < num; i++)
{
Node *s = (Node *)malloc(sizeof(Node));
s->e.data = i + 1;
s->next = NULL;
tail->next = s;
tail = s;
}
return true;
}
示例13: NewPermanent
Permanent* NewPermanent(MTGCard* source,MTGPlayer* own) {
Permanent* p = (Permanent*) calloc(1,sizeof(Permanent));
p->name = source->name;
p->subtypes = source->subtypes;
p->abilities = ListCopy(source->abilities);
if (source->subtypes.is_planeswalker)
p->loyalty = source->loyalty;
else if (source->subtypes.is_creature){
p->power = p->sourcePower = source->power;
p->toughness = p->sourceToughness = source->toughness;
p->has_summoning_sickness = true;
}
p->equipment = InitList();
p->source = source;
p->owner = own;
p->controller = own;
return p;
}
示例14: CreateListByHead
/********************************************************************
Method: CreateListByHead
Parameter: 单链表, 元素个数
Returns:
Purpose: 头插法建立单链表
*********************************************************************/
bool CreateListByHead(LinkList &L, int num)
{
InitList(L);
for (int i = 0; i < num; i++)
{
// 建立节点
Node *s = (Node *)malloc(sizeof(Node));
s->e.data = i + 1;
s->next = NULL;
// 插入
s->next = L->next;
L->next = s;
}
return true;
}
示例15: InitList
/**
* @brief Initialize the dialog.
*/
BOOL PluginsListDlg::OnInitDialog()
{
theApp.TranslateDialog(m_hWnd);
CDialog::OnInitDialog();
InitList();
AddPlugins();
BOOL pluginsEnabled = GetOptionsMgr()->GetBool(OPT_PLUGINS_ENABLED);
if (pluginsEnabled)
{
CButton *btn = (CButton *)GetDlgItem(IDC_PLUGINS_ENABLE);
btn->SetCheck(BST_CHECKED);
}
return FALSE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}