/ Vijos /

记录详情

Compile Error

/in/foo.cc: In function 'void addToHash(long long int)':
/in/foo.cc:69:32: error: no matching function for call to '_nodeH::_nodeH(void*)'
   69 | p = (nodeH)malloc(sizeof(nodeH));
      |                                ^
/in/foo.cc:11:16: note: candidate: '_nodeH::_nodeH()'
   11 | typedef struct _nodeH{
      |                ^~~~~~
/in/foo.cc:11:16: note:   candidate expects 0 arguments, 1 provided
/in/foo.cc:11:16: note: candidate: 'constexpr _nodeH::_nodeH(const _nodeH&)'
/in/foo.cc:11:16: note:   no known conversion for argument 1 from 'void*' to 'const _nodeH&'
/in/foo.cc:11:16: note: candidate: 'constexpr _nodeH::_nodeH(_nodeH&&)'
/in/foo.cc:11:16: note:   no known conversion for argument 1 from 'void*' to '_nodeH&&'
/in/foo.cc:70:2: error: base operand of '->' has non-pointer type 'nodeH' {aka '_nodeH'}
   70 | p->key = key;
      |  ^~
/in/foo.cc:71:2: error: base operand of '->' has non-pointer type 'nodeH' {aka '_nodeH'}
   71 | p->next = hash[key % MAX_SIZE];
      |  ^~
/in/foo.cc:72:24: error: cannot convert 'nodeH' {aka '_nodeH'} to 'nodeH*' {aka '_nodeH*'} in assignment
   72 | hash[key % MAX_SIZE] = p;
      |                        ^
      |                        |
      |                        nodeH {aka _nodeH}
/in/foo.cc: In function 'int isInHash(long long int)':
/in/foo.cc:75:30: error: conversion from 'nodeH*' {aka '_nodeH*'} to non-scalar type 'nodeH' {aka '_nodeH'} requested
   75 | nodeH p = hash[key % MAX_SIZE];
      |           ~~~~~~~~~~~~~~~~~~~^
/in/foo.cc:76:9: error: no match for 'operator!=' (operand types are 'nodeH' {aka '_nodeH'} and 'long int')
   76 | while(p != NULL){
      |         ^
/in/foo.cc:77:5: error: base operand of '->' has non-pointer type 'nodeH' {aka '_nodeH'}
   77 | if(p->key == key)
      |     ^~
/in/foo.cc:79:6: error: base operand of '->' has non-pointer type 'nodeH' {aka '_nodeH'}
   79 | p = p->next;
      |      ^~

信息

递交者
类型
递交
题目
P1252 @.@斗地主
语言
C++
递交时间
2025-03-20 20:35:42
评测时间
2025-03-20 20:35:42
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes