Function call missing ошибка

In main

a comma is missing in

 printf("50 = %d, 20 = %d, 10 = %d, 5 = %d" money[1], money[2], money[3], money[4]);

must be

printf("50 = %d, 20 = %d, 10 = %d, 5 = %d", money[1], money[2], money[3], money[4]);

In

void fifty(int money, int 5)

you cannot name a parameter with a number, what did you expect ?

Also the return; at the end of your void functions is useless

In main you do not initialize money[0] but all the other functions test its value, the behavior is undefined. Probably you wanted do do

scanf("%d", &money[0]);

I also encourage you to check a value was enter through the scanf, checking it returns 1. Note you are in C++ so you can also use istream operator >>

In the other function you increment entries in money but these ones are not initialized, probably you wanted :

int money[5] = {0}; 

initializing the 5 elements to 0

And because you need to access to several elelemnts in the array in the other function you do not have to give a specific element but all the array, so for instance :

fifty(money[5]);

must be

fifty(money);

and the same for the other calls

Note you suppose there is only 0 or 1 times each of the values, for instance

void fifty(int money)
{
    /*This is getting the whole array from main() and modifying the values of each index*/
    if (money[0] > 50) {
        money[0] = money[0] - 50;
        money[1]++;
    }
}

if money is 100 you must set money[1] to 2 rather than 1, for that :

void fifty(int money[])
{
    /*This is getting the whole array from main() and modifying the values of each index*/
    money[1] = money[0]/50;
    money[0] %= 50;
}

and to do that for each value produces a similar definition for all the function, this is useless, you can define only one function getting the value and the index to set, for instance :

void count(int money[], int value, int index)
{
    money[index] = money[0]/value;
    money[0] %= value;
}

and rather than to call

fifty(money);
twenty(money);
ten(money);
five(money);

you can do

count(money, 50, 1);
count(money, 20, 2);
count(money, 10, 3);
count(money, 5, 4);

or use any other way like a loop

Note that you do not indicate the number of value 1, seems strange


A proposal taking into account my remarks :

#include <stdio.h>

void count(int money[], int index, int value);

int main()
{
  int money[5]; // useless to initialize it because I just assign entries

  printf("Enter cash amount: ");

  if (scanf("%d", &money[0]) != 1) {
    puts("invalid input, abort");
    return -1;
  }

  count(money, 50, 1);
  count(money, 20, 2);
  count(money, 10, 3);
  count(money, 5, 4);

  /*The next two lines should print out how many of each denomination is needed*/
  printf("Change to be given: \n");
  printf("50 = %d, 20 = %d, 10 = %d, 5 = %d\n", money[1], money[2], money[3], money[4]);
  return(0);
}

void count(int money[], int value, int index)
{
  money[index] = money[0]/value;
  money[0] %= value;
}

Compilation and execution :

pi@raspberrypi:/tmp $ g++ -pedantic -Wall -Werror e.cc
pi@raspberrypi:/tmp $ ./a.out
Enter cash amount: 275
Change to be given: 
50 = 5, 20 = 1, 10 = 0, 5 = 1
pi@raspberrypi:/tmp $ 

And using iostream rather than stdio :

#include <iostream>

void count(int money[], int index, int value);

int main()
{
  int money[5]; // useless to initialize it because I just assign entries

  std::cout << "Enter cash amount: ";

  if (! (std::cin >> money[0])) {
    std::cout << "invalid input, abort" << std::endl;
    return -1;
  }

  count(money, 50, 1);
  count(money, 20, 2);
  count(money, 10, 3);
  count(money, 5, 4);

  std::cout << "Change to be given: \n"
    << "50 = " << money[1]
      << ", 20 = " << money[2]
    << ", 10 = " << money[3]
      << ", 5 = " << money[4] << std::endl;

  return(0);
}

void count(int money[], int value, int index)
{
  money[index] = money[0]/value;
  money[0] %= value;
}

And finally a version where the values are indicated in an array allowing to change only one line of code to change the list of bills :

#include <iostream>

void count(int money[], int value, int index);

int main()
{
  const int value[] = { 50, 20, 10, 5, 1 }; // list of biils
  int money[sizeof(value)/sizeof(value[0]) + 1];

  std::cout << "Enter cash amount: ";

  if (! (std::cin >> money[0])) {
    std::cout << "invalid input, abort" << std::endl;
    return -1;
  }

  for (size_t i = 0; i != sizeof(value)/sizeof(value[0]); ++i)
    count(money, value[i], i+1);

  std::cout << "Change to be given: \n";

  for (size_t i = 0; i != sizeof(value)/sizeof(value[0]); ++i) {
    if (i != 0)
      std::cout << ", ";
    std::cout << value[i] << " = " << money[i+1];
  }
  std::cout << std::endl;

  return(0);
}

void count(int money[], int value, int index)
{
  money[index] = money[0]/value;
  money[0] %= value;
}

Compilation and execution :

pi@raspberrypi:/tmp $ ./a.out
Enter cash amount: 276
Change to be given: 
50 = 5, 20 = 1, 10 = 0, 5 = 1, 1 = 1

Now count is called at only one location in the code, so it can be removed moving its body to replace its call :

#include <iostream>

int main()
{
  const int value[] = { 50, 20, 10, 5, 1 }; // list of bills
  int money[sizeof(value)/sizeof(value[0]) + 1];

  std::cout << "Enter cash amount: ";

  if (! (std::cin >> money[0])) {
    std::cout << "invalid input, abort" << std::endl;
    return -1;
  }

  for (size_t i = 0; i != sizeof(value)/sizeof(value[0]); ++i){
    money[i + 1] = money[0]/value[i];
    money[0] %= value[i];
  }

  std::cout << "Change to be given: \n";

  for (size_t i = 0; i != sizeof(value)/sizeof(value[0]); ++i) {
    if (i != 0)
      std::cout << ", ";
    std::cout << value[i] << " = " << money[i+1];
  }
  std::cout << std::endl;

  return(0);
}

For instance if I want to also take into account the bills of 100 I just have to replace const int value[] = { 50, 20, 10, 5, 1 }; by const int value[] = { 100, 50, 20, 10, 5, 1 }; without having to do other changes in the code. That way to do is very important for the maintainability of the code.

если в коде вызывается функция, то имя должно завершаться скобками — «имяфункции()«, в данном случае — CountBuyLimit(), CountSellLimit().

Далее, все торговые приказы должно проверять на успешное выполнение, примерно так:

               bool TicketClosed = OrderClose(OrderTicket(),OrderLots(),price,slippage*k,Yellow); //приказ на закрытие позиции
                
               if(!TicketClosed) //проверочка на успешное выполнение приказа.
                {
                        error = GetLastError(); 
                        Print("Error :",error," Closing position: ",OrderTicket());
                        Sleep(5000); 
                }

что касается второй картинки, эти предупреждения можно игнорировать, но если цель — чистый лист ошибок, то надо неиспользуемую функцию в коде закомментировать — /*function{}*/

See more:

Hellow, I am upgrading a game engine, but I get errors
I dont know how to fix it

Error Code:

1>—— Build started: Project: hl, Configuration: Debug Win32 ——
1> gonome.cpp
1>d:\src_dll\dlls\gonome.cpp(115): error C3867: ‘CGonomeSpit::Animate’: function call missing argument list; use ‘&CGonomeSpit::Animate’ to create a pointer to member
1>d:\src_dll\dlls\gonome.cpp(164): error C3867: ‘CBaseEntity::SUB_Remove’: function call missing argument list; use ‘&CBaseEntity::SUB_Remove’ to create a pointer to member

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Source Code:

void CGonomeSpit::Animate( void )
{
    pev->nextthink = gpGlobals->time + 0.1;

    if ( pev->frame++ )
    {
        if ( pev->frame > m_maxFrame )
        {
            pev->frame = 0;
        }
    }
}


class CGonomeSpit : public CBaseEntity
{
public:
	void Spawn( void );

	static void Shoot( entvars_t *pevOwner, Vector vecStart, Vector vecVelocity );
	void Touch( CBaseEntity *pOther );
	void EXPORT Animate( void );

	virtual int		Save( CSave &save );
	virtual int		Restore( CRestore &restore );
	static	TYPEDESCRIPTION m_SaveData[];

	int  m_maxFrame;
};

I have no idea to fix the code

Please help me

Updated 17-Oct-21 19:59pm


There is a little difference between the older compiler and the newer:

void mycallback()
{
}
void worker(void (*fn)())
{
  (*fn)();
}
void main()
{
  
  worker(mycallback); 
  
  worker(&mycallback); 
}

Regards.

You might also have somthing wrong before that like a missing } which would cause the compiler to try to compile the code as if it was inside a function.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject,
20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8
+1 (416) 849-8900

Сообщения об ошибках Сообщения об ошибках периода компиляции

«,»
expected

(Нужно указать «,»).

Array
bounds missing «]»

(Массив ограничивает отсутствие «]»).

Array
must have at least one element

(Массив
должен
иметь
по
крайней
мере
один элемент).

Call
of nonfunction

(Нефункциональное обращение).

Call
to function ‘function’ with no prototype

(Обращение
к
функции
«функция»
без
прототипа).

Code
has no effect

(Код не имеет эффекта).

Compound
statement missing «}»
(Утверждение,
пропускающее
«}»).

Declaration
is not allowed here

(Здесь
не
допускается
объявление).

Declaration
missing «;»

(Отсутствие
объявления
«;»).

Declaration
syntax
error
(Синтаксическая ошибка, объявление
переменной).

Declaration
terminated incorrectly

(Объявления,
завершенные
неправильно).

Delete
array size missing «]»
(Отсутствие
скобки
«]»).

do-while
statement missing ;OR For statement missing ;

(Отсутствие
утверждения
do-while, или
отсутствие
утверждения
For).

Expression
syntax

(Ошибка синтаксиса в выражении).

Extra
parameter in call to function

(Недопустимый параметр в обращении к
функции).

Function
call missing «)»

(В обращении к функции отсутствует
«)»).

Illegal
initialization

(Неверная
инициализация).

Illegal
character ‘character’

(Неверный
символ
» символ
«).

Illegal
structure operation

(Неверная операция структуры).

Illegal
use of pointer

(Неверное использование указателя).

‘identifier’
cannot start a parameter declaration

(Идентификатор
не
может
начать объявление параметра).

identifier
is
assigned
a
value
which
is
never
used
(Идентификатор определяет значение,
которое ранее не использовалось).

Invalid
indirection

(Недопустимый ссылка).

Lvalue
required

(Требуется наименование выражения
(адрес переменной)).

Member
identifier expected

(Ожидается значение идентификатора).

Multiple
declaration for ‘identifier’

(Многократные объявления для
идентификатора).

Must
take
address
of
a
memory
location
(Необходимо взять адрес расположения
памяти).

Non-portable
pointer conversion

(Преобразования указателя не переносятся).

Not
an allowed type

(Недопустимый
тип).

Operator
«[]» missing «]»

(Оператор «[]» не имеет «]»).

Overlays
only
supported
in
medium,
large,
and
huge
memory
models
(Оверлейные программы, поддерживаемые
только в среде, большие и огромные модели
памяти).

Parameter
parameter
is
never
used
(Параметр «параметр» ранее никогда
не использовался).

Size
of ‘identifier’ is unknown or zero

(Размер идентификатора неизвестен
или нуль).

Structure
required on left side of . or .*

(Ошибка
структуры на левой стороне, или отсутствие
«*»).

Two
consecutive dots

(Наличие двух последовательных точек).

Too
few parameters in call to ‘function’

(Несколько
параметров
в
обращении
к
«функции»).

Too
many initializers

(Слишком много инициализаторов).

Too
many
error
or
warning
messages
(Слишком много ошибок или предупреждений).

Type
mismatch
in
parameter
parameter
in
call
to
function
(Несоответствие типов в параметре
«параметр» при обращении к «функции»).

Type
mismatch
in
redeclaration
of
identifier
(Несоответствия типов в повторном
определении идентификатора).

Value
of type void is not allowed

(Недопустимые значения типа).

Variable
identifier
is
initialized
more
than
once
(Идентификатор переменной инициализирован
более одного раза).

Unable
to open include file ‘filename’

(Невозможно
открыть
файл).

Undefined
structure ‘structure’

(Неопределенная структура «структура»).

Undefined
symbol ‘identifier’

(Неопределенный символ идентификатора).

Undefined
symbol
symbol
in
module
module
(Неопределенный символ «символ» в
модуле «модуль»).

Unexpected
«}»

(Непредвиденная «}»).

Unknown
preprocessor
directive:
identifier
(Неизвестны директивы препроцессора:
идентификатора).

Wrong
number
of
arguments
in
call
of
macro
macro
(Неправильное число параметров в
обращении макрокоманды » макрокоманда
«).

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]

  • #
  • #
  • #
  • #
  • #
  • #
  • #
  • #
  • #
  • #
  • #

Go Up to Compiler Errors And Warnings (C++) Index

The function call argument list had some sort of syntax error, such as a missing or mismatched right parenthesis.

Понравилась статья? Поделить с друзьями:
  • Galanz сплит система коды ошибок
  • Game launcher exe системная ошибка
  • G62 ошибка 601
  • Fuel reserve ошибка на бмв е60
  • Function agetstationconfig not found on пишет ошибку rkeeper