char* n=m.getName();
Run Code Online (Sandbox Code Playgroud)
Invalid arguments ' Candidates are: char * getName() '上述指令出现以下错误.我错过了什么?
char* Medicine::getName()
{
return this->name;
}
Run Code Online (Sandbox Code Playgroud)
name被声明为char name[50];和m是const Medicine& m
所以,我有这个结构:
typedef struct {
int day;
int amount;
char type[4],desc[20];
}transaction;
Run Code Online (Sandbox Code Playgroud)
这个函数用于填充在main中声明的事务类型的向量:
void transact(transaction t[],int &n)
{
for(int i=0;i<n;i++)
{
t[i].day=GetNumber("Give the day:");
t[i].amount=GetNumber("Give the amount of money:");
t[i].type=GetNumber("Give the transaction type:");
t[i].desc=GetNumber("Give the descripition:");
}
}
Run Code Online (Sandbox Code Playgroud)
我在函数头部得到的错误transact():
Multiple markers at this line
- Syntax error
- expected ';', ',' or ')' before '&' token
(defun remov(l)
(defparameter z ())
(setq contor 0)
(setq counter 0)
(dolist (elem l)
(if
(or (< (expt 2 contor) counter) (> (expt 2 contor) counter))
((push elem z) (setq contor (+ 1 contor))) (setq counter (+ 1 counter)))
)
(print e)
)
Run Code Online (Sandbox Code Playgroud)
我为什么要这样Error: Illegal function object: (PUSH ELEM Z).
[condition type: TYPE-ERROR]?这是什么意思?
public void delete10(){
T s = null;
try {
s=x.pop();
while(s.avg()<10)
s=x.pop();
}
Run Code Online (Sandbox Code Playgroud)
我得到了The method avg() is undefined for the type T.现在我明白avg()并没有在类型T上实现,但它是在我将使用的类型而不是T这个泛型上实现的.我怎么能做对的?
public E pop() throws EmptyStackException {
if (empty()) {
throw new EmptyStackException();
}
E result = top.item;
top = top.next;
return result;
}
Run Code Online (Sandbox Code Playgroud)