小编Mat*_*att的帖子

类中的参数无效

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];mconst Medicine& m

c++ arguments class

4
推荐指数
1
解决办法
831
查看次数

结构类型数组,C错误

所以,我有这个结构:

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

c arrays struct pointers

1
推荐指数
1
解决办法
181
查看次数

在推杆中推错误

(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]?这是什么意思?

lisp

1
推荐指数
1
解决办法
90
查看次数

泛型和方法

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)

java generics

0
推荐指数
1
解决办法
63
查看次数

标签 统计

arguments ×1

arrays ×1

c ×1

c++ ×1

class ×1

generics ×1

java ×1

lisp ×1

pointers ×1

struct ×1