this function is returning this error:
Code:
q.cpp In function 'int main()':
q.cpp:86: cannot convert 'int' to char* for argument 1 to insert char*
I'm trying to be able to scan in a string so that i can use an integer of like 2 numbers for my queue.. as in 10/11/12.. right now i can only use single integer values...
here is the source:
Code:
void insert(char character_to_be_inserted[NAME_LENGTH]) /************* INSERT
***********************/
{
QUEUE_NODE *temp_new_node_pointer; /* Used to point to a newly
created node
before it is linked into
the queue */
temp_new_node_pointer = (QUEUE_NODE *) malloc(sizeof(QUEUE_NODE));
temp_new_node_pointer->queued_data[NAME_LENGTH] = character_to_be_inserted[NAME_LENGTH];
if (Q == NULL) /* This is the Queue_empty
condition */
{
Q = temp_new_node_pointer;
Q->next_in_queue = Q;
}
else
{
temp_new_node_pointer->next_in_queue = Q->next_in_queue;
Q->next_in_queue = temp_new_node_pointer;
Q=temp_new_node_pointer;
}
}
main() /******************** MAIN
******************************/
{
ios::sync_with_stdio();
char operators_choice;
do
{
printf("\n Enter choice (lower case is acceptable) --- (I)nsert,
(R)emove, or (Q)uit: ");
fflush(stdout);
operators_choice=getchar(); getchar(); /* Second getchar just
discards the carriage
return used to enter the oeprator's choice */
switch (operators_choice)
{
case 'i': case 'I':
printf(" Enter character to be enqueued: "); fflush(stdout);
insert(cin.get());
cin.ignore(80,'\n');
break; /* return used to enter the enqueued character */
case 'r': case 'R':
if (Q == NULL)
{
printf(" Queue already empty\n"); fflush(stdout);
}
else
{
printf(" The character removed was '%c'\n",
removed_from_queue());
fflush(stdout);
}
break;
default:
if (operators_choice == 'Q' || operators_choice == 'q') break;
printf("\n Please enter your choice of 'I', 'i', 'F', 'f', 'Q', or 'q',
only.\n");
fflush(stdout);
}
} while ( !(operators_choice == 'Q' || operators_choice == 'q') );
}
i also have my remove function, i'm assuming it still works..
thanks