Question

I'm getting errors that i can't figure out. I need help fixing them. particularly focus on...

I'm getting errors that i can't figure out. I need help fixing them. particularly focus on the errors they are highlighted in bold on the list

code:

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include <math.h>

#include <ctype.h>

#include "stack.h"

#include "booleanEvaluation.h"

#include "booleanWithError.h"

/* evaluatePostfix

* input: a postfix expression

* output: T, F, or E

*

* Uses a stack to evaluates the postfix expression and returns the result as a string where "T" denotes true and "F" denotes false.

* If the postfix expression is invalid it returns "E" to denote an error has occurred.

*/


char *evaluatePostfix( char *str )

{

//declaring all variables

int index = 0;

int count;

char **result;

Stack *postFixStack;

char *op1, *op2;

//counting the number of tokens in the string

count = countTokens(str);

//result array is the new string created by tokens

result = tokenizeString(str);

postFixStack = createStack();

while(index < count) {

if(strcmp(result[index], "T") == 0 || strcmp(result[index], "F") == 0) {

push(postFixStack, result[index]);

index++;

}

else if(strcmp(result[index], "NOT") == 0) {

op1 = pop(postFixStack);

if(strcmp(op1, "T") == 0)

strcpy(op1, "F");

else

strcpy(op1, "T");

push(postFixStack, op1);

index++;

}

else if(strcmp(result[index], "AND") == 0 ||

strcmp(result[index], "NAND") == 0 ||

strcmp(result[index], "OR") == 0 ||

strcmp(result[index], "NOR") == 0 ||

strcmp(result[index], "XOR") == 0 ||

strcmp(result[index], "COND") == 0 ||

strcmp(result[index], "BICOND") == 0)

{

op2 = pop(postFixStack);

op1 = pop(postFixStack);

if(op1 == NULL || op2 == NULL)

return booleanToString(ERROR);

if(strcmp(result[index], "AND") == 0)

strcpy(op1, booleanToString(stringToBoolean(op1) && stringToBoolean(op2)));

else if(strcmp(result[index], "NAND") == 0)

strcpy(op1, booleanToString(!(stringToBoolean(op1) && stringToBoolean(op2))));

else if(strcmp(result[index], "OR") == 0)

strcpy(op1, booleanToString(stringToBoolean(op1) || stringToBoolean(op2)));

else if(strcmp(result[index], "NOR") == 0)

strcpy(op1, booleanToString(!(stringToBoolean(op1) || stringToBoolean(op2))));

else if(strcmp(result[index], "XOR") == 0)

strcpy(op1, booleanToString(stringToBoolean(op1) != stringToBoolean(op2)));

else if(strcmp(result[index], "COND") == 0)

strcpy(op1, booleanToString((!stringToBoolean(op1)) || stringToBoolean(op2)));

else if(strcmp(result[index], "BICOND") == 0)

strcpy(op1, booleanToString(stringToBoolean(op1) == stringToBoolean(op2)));

push(postFixStack, op1);

free(op2);

index++;

}

}

op1 = pop(postFixStack);

if(!isEmpty(postFixStack))

return booleanToString(ERROR);

return op1;

}

/* postfixToInfix

* input: a postfix expression

* output: the equivalent infix expression

*

* Uses a stack to convert str to its equivalent expression in infix.

* You can assume that the postfix expression is valid

*/

char *postfixToInfix( char *str )

{

//declaring all variables

int index = 0;

int count;

char **result;

Stack *postFixToInfixStack;

char *op1, *op2, *evaluation;

//counting the number of tokens in the string

count = countTokens(str);

//result array is the new string created by tokens

result = tokenizeString(str);

postFixToInfixStack = createStack();

while(index < count) {

if(strcmp(result[index], "T") == 0 || strcmp(result[index], "F") == 0) {

push(postFixToInfixStack, result[index]);

index++;

}

else if(strcmp(result[index], "NOT") == 0) {

op1 = pop(postFixToInfixStack);

if(op1 == NULL)

return "E";

evaluation = (char*)malloc(sizeof(char));

evaluation = concatenateString(op1, "blank", result[index]);

push(postFixToInfixStack, evaluation);

free(op1);

index++;

}

else if(strcmp(result[index], "AND") == 0 ||

strcmp(result[index], "NAND") == 0 ||

strcmp(result[index], "OR") == 0 ||

strcmp(result[index], "NOR") == 0 ||

strcmp(result[index], "XOR") == 0 ||

strcmp(result[index], "COND") == 0 ||

strcmp(result[index], "BICOND") == 0)

{

op2 = pop(postFixToInfixStack);

op1 = pop(postFixToInfixStack);

if(op1 == NULL || op2 == NULL)

return "E";

evaluation = concatenateString(op1, op2, result[index]);

push(postFixToInfixStack, evaluation);

free(op1);

free(op2);

index++;

}

}

evaluation = (char*)malloc(sizeof(char));

evaluation = pop(postFixToInfixStack);

if(!isEmpty(postFixToInfixStack))

return booleanToString(ERROR);

return evaluation;

}


/* countTokens

* input: a zero terminated string

* output: The number of space separated tokens in str

*

*/

int countTokens( char *str ){

int cnt = 0; //number of tokens found

int strLength = strlen( str ); //length of the string str

int index = 1; //location in str

//if str starts with a token, increment cnt

if( str[0]!=' ' )

cnt++;

//Loop through all of the remaining chars in str

while( index<strLength ) {

//If you've found the start of a token increment cnt

//(i.e., prior char = ' ' and current char is not = ' ')

if( str[index-1]==' ' && str[index]!=' ' ) {

cnt++;

}

index++;

}

return cnt;

}

/* tokenizeString

* input: a zero terminated string

* output: an array of dynamically strings which contains the ' ' separated tokens of str

*

* Note: This function mallocs space. The caller is responsible for freeing this malloc-ed array of strings.

*/

char **tokenizeString( char *str ){

int strLength = strlen( str );

int cnt = countTokens( str );

int index = 0; //current index into str

int curToken = 0; //current token index to be added

char *buffer = (char *)malloc( sizeof(char)*(strLength+1) );

char **arrTokens = (char **)malloc( sizeof(char*)*cnt );

if( buffer==NULL || arrTokens==NULL )

exit(-1);

while( index<strLength ){

int bufferIndex=0; //current buffer index

//Skip space characters

while( index<strLength && str[index]==' ' )

index++;

//if no new token found, leave the loop

if(index == strLength)

break;

//Copy the next token into buffer

while( index<strLength && str[index]!=' ' ){

buffer[bufferIndex] = str[index];

index++;

bufferIndex++;

}

buffer[bufferIndex] = '\0'; //Put null terminator at end of buffer string

//malloc space for most recent token

arrTokens[curToken] = (char *)malloc( sizeof(char)*(bufferIndex+1) );

if( arrTokens[curToken]==NULL )

exit(-1);

//copy buffer into the array of tokens

strcpy( arrTokens[curToken], buffer );

curToken++;

}

free(buffer);

return arrTokens;

}

/* concatenateString

* input: two operation values and their operation

* output: a single concatenated string to be pushed to the stack

*/

char *concatenateString(char *op1, char *op2, char *operation) {

char *evaluation = (char*)malloc(sizeof(char));

strcpy(evaluation, "");

if(strcmp(operation, "NOT") == 0) {

strcat(evaluation, "( NOT ");

strcat(evaluation, op1);

strcat(evaluation, " )");

}

if(strcmp(operation, "AND") == 0) {

strcat(evaluation, "( ");

strcat(evaluation, op1);

strcat(evaluation, " AND ");

strcat(evaluation, op2);

strcat(evaluation, " )");

}

else if(strcmp(operation, "NAND") == 0) {

strcat(evaluation, "( ");

strcat(evaluation, op1);

strcat(evaluation, " NAND ");

strcat(evaluation, op2);

strcat(evaluation, " )");

}

else if(strcmp(operation, "OR") == 0) {

strcat(evaluation, "( ");

strcat(evaluation, op1);

strcat(evaluation, " OR ");

strcat(evaluation, op2);

strcat(evaluation, " )");

}

else if(strcmp(operation, "NOR") == 0) {

strcat(evaluation, "( ");

strcat(evaluation, op1);

strcat(evaluation, " NOR ");

strcat(evaluation, op2);

strcat(evaluation, " )");

}

else if(strcmp(operation, "XOR") == 0) {

strcat(evaluation, "( ");

strcat(evaluation, op1);

strcat(evaluation, " XOR ");

strcat(evaluation, op2);

strcat(evaluation, " )");

}

else if(strcmp(operation, "COND") == 0) {

strcat(evaluation, "( ");

strcat(evaluation, op1);

strcat(evaluation, " COND ");

strcat(evaluation, op2);

strcat(evaluation, " )");

}

else if(strcmp(operation, "BICOND") == 0) {

strcat(evaluation, "( ");

strcat(evaluation, op1);

strcat(evaluation, " BICOND ");

strcat(evaluation, op2);

strcat(evaluation, " )");

}

return evaluation;

}


**Code ends here**

errors:

assignment 2 test/booleanEvaluation.c:30:9: warning: implicit declaration
of function 'countTokens' is invalid in C99
[-Wimplicit-function-declaration]
count = countTokens(str);
^
assignment 2 test/booleanEvaluation.c:32:10: warning: implicit declaration
of function 'tokenizeString' is invalid in C99
[-Wimplicit-function-declaration]
result = tokenizeString(str);
^
assignment 2 test/booleanEvaluation.c:32:8: warning: incompatible integer
to pointer conversion assigning to 'char **' from 'int'
[-Wint-conversion]
result = tokenizeString(str);
^ ~~~~~~~~~~~~~~~~~~~
assignment 2 test/booleanEvaluation.c:111:9: warning: implicit declaration
of function 'countTokens' is invalid in C99
[-Wimplicit-function-declaration]
count = countTokens(str);
^
assignment 2 test/booleanEvaluation.c:113:10: warning: implicit declaration
of function 'tokenizeString' is invalid in C99
[-Wimplicit-function-declaration]
result = tokenizeString(str);
^
assignment 2 test/booleanEvaluation.c:113:8: warning: incompatible integer
to pointer conversion assigning to 'char **' from 'int'
[-Wint-conversion]
result = tokenizeString(str);
^ ~~~~~~~~~~~~~~~~~~~
assignment 2 test/booleanEvaluation.c:129:14: warning: implicit declaration
of function 'concatenateString' is invalid in C99
[-Wimplicit-function-declaration]
evaluation = concatenateString(op1, "blank", result[index]);
^
assignment 2 test/booleanEvaluation.c:129:12: warning: incompatible integer
to pointer conversion assigning to 'char *' from 'int'
[-Wint-conversion]
evaluation = concatenateString(op1, "blank", result[index]);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
assignment 2 test/booleanEvaluation.c:150:14: warning: implicit declaration
of function 'concatenateString' is invalid in C99
[-Wimplicit-function-declaration]
evaluation = concatenateString(op1, op2, result[index]);
^
assignment 2 test/booleanEvaluation.c:150:12: warning: incompatible integer
to pointer conversion assigning to 'char *' from 'int'
[-Wint-conversion]
evaluation = concatenateString(op1, op2, result[index]);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
assignment 2 test/booleanEvaluation.c:203:6: error: conflicting types for
'tokenizeString'
char tokenizeString( char *str ){
^
assignment 2 test/booleanEvaluation.c:32:10: note: previous implicit
declaration is here
result = tokenizeString(str);
^
assignment 2 test/booleanEvaluation.c:246:8: warning: incompatible pointer
to integer conversion returning 'char **' from a function with result
type 'char' [-Wint-conversion]
return arrTokens;
^~~~~~~~~
assignment 2 test/booleanEvaluation.c:253:6: error: conflicting types for
'concatenateString'
char concatenateString(char *op1, char *op2, char *operation) {
^
assignment 2 test/booleanEvaluation.c:129:14: note: previous implicit
declaration is here
evaluation = concatenateString(op1, "blank", result[index]);
^
assignment 2 test/booleanEvaluation.c:313:8: warning: incompatible pointer
to integer conversion returning 'char *' from a function with result
type 'char'; dereference with * [-Wint-conversion]
return evaluation;
^~~~~~~~~~
*
12 warnings and 2 errors generated.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Please let me know if you need more information:-
=======================

=====

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

#include <math.h>

#include <ctype.h>

#include "stack.h"

#include "booleanEvaluation.h"

#include "booleanWithError.h"

//Added Code - START
//Note: you must declare these before you are calling so you just need to add this function signatures at the top.

char *concatenateString(char *op1, char *op2, char *operation);
char **tokenizeString( char *str );
int countTokens( char *str );
char *postfixToInfix( char *str );
char *evaluatePostfix( char *str );

///And better to move the function definition to TOP. means before main.

//Added Code - END.

/* evaluatePostfix

* input: a postfix expression

* output: T, F, or E

*

* Uses a stack to evaluates the postfix expression and returns the result as a string where "T" denotes true and "F" denotes false.

* If the postfix expression is invalid it returns "E" to denote an error has occurred.

*/

char *evaluatePostfix( char *str )

{

//declaring all variables

int index = 0;

int count;

char **result;

Stack *postFixStack;

char *op1, *op2;

//counting the number of tokens in the string

count = countTokens(str);

//result array is the new string created by tokens

result = tokenizeString(str);

postFixStack = createStack();

while(index < count) {

if(strcmp(result[index], "T") == 0 || strcmp(result[index], "F") == 0) {

push(postFixStack, result[index]);

index++;

}

else if(strcmp(result[index], "NOT") == 0) {

op1 = pop(postFixStack);

if(strcmp(op1, "T") == 0)

strcpy(op1, "F");

else

strcpy(op1, "T");

push(postFixStack, op1);

index++;

}

else if(strcmp(result[index], "AND") == 0 ||

strcmp(result[index], "NAND") == 0 ||

strcmp(result[index], "OR") == 0 ||

strcmp(result[index], "NOR") == 0 ||

strcmp(result[index], "XOR") == 0 ||

strcmp(result[index], "COND") == 0 ||

strcmp(result[index], "BICOND") == 0)

{

op2 = pop(postFixStack);

op1 = pop(postFixStack);

if(op1 == NULL || op2 == NULL)

return booleanToString(ERROR);

if(strcmp(result[index], "AND") == 0)

strcpy(op1, booleanToString(stringToBoolean(op1) && stringToBoolean(op2)));

else if(strcmp(result[index], "NAND") == 0)

strcpy(op1, booleanToString(!(stringToBoolean(op1) && stringToBoolean(op2))));

else if(strcmp(result[index], "OR") == 0)

strcpy(op1, booleanToString(stringToBoolean(op1) || stringToBoolean(op2)));

else if(strcmp(result[index], "NOR") == 0)

strcpy(op1, booleanToString(!(stringToBoolean(op1) || stringToBoolean(op2))));

else if(strcmp(result[index], "XOR") == 0)

strcpy(op1, booleanToString(stringToBoolean(op1) != stringToBoolean(op2)));

else if(strcmp(result[index], "COND") == 0)

strcpy(op1, booleanToString((!stringToBoolean(op1)) || stringToBoolean(op2)));

else if(strcmp(result[index], "BICOND") == 0)

strcpy(op1, booleanToString(stringToBoolean(op1) == stringToBoolean(op2)));

push(postFixStack, op1);

free(op2);

index++;

}

}

op1 = pop(postFixStack);

if(!isEmpty(postFixStack))

return booleanToString(ERROR);

return op1;

}

/* postfixToInfix

* input: a postfix expression

* output: the equivalent infix expression

*

* Uses a stack to convert str to its equivalent expression in infix.

* You can assume that the postfix expression is valid

*/

char *postfixToInfix( char *str )

{

//declaring all variables

int index = 0;

int count;

char **result;

Stack *postFixToInfixStack;

char *op1, *op2, *evaluation;

//counting the number of tokens in the string

count = countTokens(str);

//result array is the new string created by tokens

result = tokenizeString(str);

postFixToInfixStack = createStack();

while(index < count) {

if(strcmp(result[index], "T") == 0 || strcmp(result[index], "F") == 0) {

push(postFixToInfixStack, result[index]);

index++;

}

else if(strcmp(result[index], "NOT") == 0) {

op1 = pop(postFixToInfixStack);

if(op1 == NULL)

return "E";

evaluation = (char*)malloc(sizeof(char));

evaluation = concatenateString(op1, "blank", result[index]);

push(postFixToInfixStack, evaluation);

free(op1);

index++;

}

else if(strcmp(result[index], "AND") == 0 ||

strcmp(result[index], "NAND") == 0 ||

strcmp(result[index], "OR") == 0 ||

strcmp(result[index], "NOR") == 0 ||

strcmp(result[index], "XOR") == 0 ||

strcmp(result[index], "COND") == 0 ||

strcmp(result[index], "BICOND") == 0)

{

op2 = pop(postFixToInfixStack);

op1 = pop(postFixToInfixStack);

if(op1 == NULL || op2 == NULL)

return "E";

evaluation = concatenateString(op1, op2, result[index]);

push(postFixToInfixStack, evaluation);

free(op1);

free(op2);

index++;

}

}

evaluation = (char*)malloc(sizeof(char));

evaluation = pop(postFixToInfixStack);

if(!isEmpty(postFixToInfixStack))

return booleanToString(ERROR);

return evaluation;

}

/* countTokens

* input: a zero terminated string

* output: The number of space separated tokens in str

*

*/

int countTokens( char *str ){

int cnt = 0; //number of tokens found

int strLength = strlen( str ); //length of the string str

int index = 1; //location in str

//if str starts with a token, increment cnt

if( str[0]!=' ' )

cnt++;

//Loop through all of the remaining chars in str

while( index<strLength ) {

//If you've found the start of a token increment cnt

//(i.e., prior char = ' ' and current char is not = ' ')

if( str[index-1]==' ' && str[index]!=' ' ) {

cnt++;

}

index++;

}

return cnt;

}

/* tokenizeString

* input: a zero terminated string

* output: an array of dynamically strings which contains the ' ' separated tokens of str

*

* Note: This function mallocs space. The caller is responsible for freeing this malloc-ed array of strings.

*/

char **tokenizeString( char *str ){

int strLength = strlen( str );

int cnt = countTokens( str );

int index = 0; //current index into str

int curToken = 0; //current token index to be added

char *buffer = (char *)malloc( sizeof(char)*(strLength+1) );

char **arrTokens = (char **)malloc( sizeof(char*)*cnt );

if( buffer==NULL || arrTokens==NULL )

exit(-1);

while( index<strLength ){

int bufferIndex=0; //current buffer index

//Skip space characters

while( index<strLength && str[index]==' ' )

index++;

//if no new token found, leave the loop

if(index == strLength)

break;

//Copy the next token into buffer

while( index<strLength && str[index]!=' ' ){

buffer[bufferIndex] = str[index];

index++;

bufferIndex++;

}

buffer[bufferIndex] = '\0'; //Put null terminator at end of buffer string

//malloc space for most recent token

arrTokens[curToken] = (char *)malloc( sizeof(char)*(bufferIndex+1) );

if( arrTokens[curToken]==NULL )

exit(-1);

//copy buffer into the array of tokens

strcpy( arrTokens[curToken], buffer );

curToken++;

}

free(buffer);

return arrTokens;

}

/* concatenateString

* input: two operation values and their operation

* output: a single concatenated string to be pushed to the stack

*/

char *concatenateString(char *op1, char *op2, char *operation) {

char *evaluation = (char*)malloc(sizeof(char));

strcpy(evaluation, "");

if(strcmp(operation, "NOT") == 0) {

strcat(evaluation, "( NOT ");

strcat(evaluation, op1);

strcat(evaluation, " )");

}

if(strcmp(operation, "AND") == 0) {

strcat(evaluation, "( ");

strcat(evaluation, op1);

strcat(evaluation, " AND ");

strcat(evaluation, op2);

strcat(evaluation, " )");

}

else if(strcmp(operation, "NAND") == 0) {

strcat(evaluation, "( ");

strcat(evaluation, op1);

strcat(evaluation, " NAND ");

strcat(evaluation, op2);

strcat(evaluation, " )");

}

else if(strcmp(operation, "OR") == 0) {

strcat(evaluation, "( ");

strcat(evaluation, op1);

strcat(evaluation, " OR ");

strcat(evaluation, op2);

strcat(evaluation, " )");

}

else if(strcmp(operation, "NOR") == 0) {

strcat(evaluation, "( ");

strcat(evaluation, op1);

strcat(evaluation, " NOR ");

strcat(evaluation, op2);

strcat(evaluation, " )");

}

else if(strcmp(operation, "XOR") == 0) {

strcat(evaluation, "( ");

strcat(evaluation, op1);

strcat(evaluation, " XOR ");

strcat(evaluation, op2);

strcat(evaluation, " )");

}

else if(strcmp(operation, "COND") == 0) {

strcat(evaluation, "( ");

strcat(evaluation, op1);

strcat(evaluation, " COND ");

strcat(evaluation, op2);

strcat(evaluation, " )");

}

else if(strcmp(operation, "BICOND") == 0) {

strcat(evaluation, "( ");

strcat(evaluation, op1);

strcat(evaluation, " BICOND ");

strcat(evaluation, op2);

strcat(evaluation, " )");

}

return evaluation;

}
============

Add a comment
Know the answer?
Add Answer to:
I'm getting errors that i can't figure out. I need help fixing them. particularly focus on...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Today assignment , find the errors in this code and fixed them. Please I need help...

    Today assignment , find the errors in this code and fixed them. Please I need help with find the errors and how ro fixed them. #include <iostream> #include <cstring> #include <iomanip> using namespace std; const int MAX_CHAR = 100; const int MIN_A = 90; const int MIN_B = 80; const int MIN_C = 70; double getAvg(); char determineGrade(double); void printMsg(char grade); int main() { double score; char grade; char msg[MAX_CHAR]; strcpy(msg, "Excellent!"); strcpy(msg, "Good job!"); strcpy(msg, "You've passed!"); strcpy(msg, "Need...

  • I am having problems with the following assignment. It is done in the c language. The...

    I am having problems with the following assignment. It is done in the c language. The code is not reading the a.txt file. The instructions are in the picture below and so is my code. It should read the a.txt file and print. The red car hit the blue car and name how many times those words appeared. Can i please get some help. Thank you. MY CODE: #include <stdio.h> #include <stdlib.h> #include <string.h> struct node { char *str; int...

  • I need assistance with this code. Is there any way I can create this stack class (dealing with infix to postfix then postfix evaluation) without utilizing <stdio.h> and <math.h>? ________...

    I need assistance with this code. Is there any way I can create this stack class (dealing with infix to postfix then postfix evaluation) without utilizing <stdio.h> and <math.h>? ____________________________________________________________________________________________ C++ Program: #include <iostream> #include <string> #include <stdio.h> #include <math.h> using namespace std; //Stack class class STACK { private: char *str; int N; public: //Constructor STACK(int maxN) { str = new char[maxN]; N = -1; } //Function that checks for empty int empty() { return (N == -1); } //Push...

  • Here is the code I have so far. I'm trying to figure out how to implement...

    Here is the code I have so far. I'm trying to figure out how to implement a boolean and use precedence. The 2nd expression should be 14 but it comes out as 28 so I'm definitely not understanding. #include <stack> #include <iostream> #include <string> using namespace std; // Function to find precedence of // operators. int precedence(char op) {    if (op == '+' || op == '-')        return 1;    if (op == '*' || op ==...

  • Let’s build a dynamic string tokenizer! Start with the existing template and work on the areas...

    Let’s build a dynamic string tokenizer! Start with the existing template and work on the areas marked with TODO in the comments: Homework 8 Template.c Note: If you turn the template back into me without adding any original work you will receive a 0. By itself the template does nothing. You need to fill in the code to dynamically allocate an array of strings that are returned to the user. Remember: A string is an array. A tokenizer goes through...

  • Need help for C program. Thx #include <stdio.h> #include <string.h> #include <ctype.h> // READ BEFORE YOU...

    Need help for C program. Thx #include <stdio.h> #include <string.h> #include <ctype.h> // READ BEFORE YOU START: // This homework is built on homework 06. The given program is an updated version of hw06 solution. It begins by displaying a menu to the user // with the add() function from the last homework, as well as some new options: add an actor/actress to a movie, display a list of movies for // an actor/actress, delete all movies, display all movies,...

  • I need help with this C code Can you explain line by line? Also can you...

    I need help with this C code Can you explain line by line? Also can you explain to me the flow of the code, like the flow of how the compiler reads it. I need to present this and I want to make sure I understand every single line of it. Thank you! /* * Converts measurements given in one unit to any other unit of the same * category that is listed in the database file, units.txt. * Handles...

  • Hello, I have some errors in my C++ code when I try to debug it. I...

    Hello, I have some errors in my C++ code when I try to debug it. I tried to follow the requirements stated below: Code: // Linked.h #ifndef INTLINKEDQUEUE #define INTLINKEDQUEUE #include <iostream> usingnamespace std; class IntLinkedQueue { private: struct Node { int data; Node *next; }; Node *front; // -> first item Node *rear; // -> last item Node *p; // traversal position Node *pp ; // previous position int size; // number of elements in the queue public: IntLinkedQueue();...

  • I am getting the Segmentation fault error on the Ubuntu machine but not on macOS. Any...

    I am getting the Segmentation fault error on the Ubuntu machine but not on macOS. Any help would be appreciated. /**** main.c ****/ #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <time.h> #include <unistd.h> #include <pthread.h> #include <string.h> #define WORD_LEN 6 #define TOP 10 char * delim = "\"\'.“”‘’?:;-,—*($%)! \t\n\x0A\r"; struct Word { char word[30]; int freq; }; int threadCount; int fileDescriptor; int fileSize; off_t chunk; struct Word* wordArray; int arrIndex = 0; pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;...

  • I need help fixing my code.   My output should be the following. Hello, world! : false...

    I need help fixing my code.   My output should be the following. Hello, world! : false A dog, a panic in a pagoda : true A dog, a plan, a canal, pagoda : true Aman, a plan, a canal--Panama! : true civic : true If I had a hi-fi : true Do geese see God? : true Madam, I’m Adam. : true Madam, in Eden, I’m Adam. : true Neil, a trap! Sid is part alien! : true Never odd...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT