Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hello. Can anyone help me with my code? I've restarted so many times and I'm just exhausted. It's due tonight. bool checkCode(char); { void writeDataToFile(const

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedHello. Can anyone help me with my code? I've restarted so many times and I'm just exhausted. It's due tonight.

bool checkCode(char);

{

void writeDataToFile(const char *);

void readDataFromFile(const char *);

double findNyanCatValue(double myNum, double last, double steps)

{cout

do

{

if(myNum

{ value= myNum;

int x= 6;

int i=1;

while(i

{ x= x*6; }

value =((2 * value)+ (value * x));

cout

myNum = myNum + steps;

if(myNum > last)

{break;}

}

}while(myNum

return value;

}

int factorial(unsigned int n)

{

unsigned long long factorial = 1;

cout

cin >> n;

for(int i = 1; i

{

factorial *= i;

}

cout

return 0;

}

int fibonacci(int n)

{

t1 = 0, t2 = 1, nextTerm = 0;

cout

cin >> n;

cout

for (int i = 1; i

{

// Prints the first two terms.

if(i == 1)

{

cout

continue;

}

if(i == 2)

{

cout

continue;

}

nextTerm = t1 + t2;

t1 = t2;

t2 = nextTerm;

cout

}

return 0;

}

double findSqrtValue(double square, double last, double steps)

{

double value;

cout

do

{

if(square

{

value = square;

double root=value/3;

int i;

if (value

for (i=0; i

root = (root + value / root) / 2;

cout

square = square + steps;

if(square > last)

{break;}

}

}while(square

return root;

}

double naturalLog(double l)

{cout

int findNextOddValue(int d);

You need to write a C++ program that will interactively accept commands from the user. Each command is a single character followed by one, two, or three parameters and specifies a function that needs to be performed. Your program must do the following Ask the user for the next command code-"Please enter command code : " Read the command code . If the command is illegal, print an appropriate error message "Invalid command code" . else if the command is quit, terminate the program . else ask the user for the parameters- "Please enter command parameters:" . Read the arguments Execute command Your program must continue this loop until the "quit" command is given. Commands that you need to include: Forf B or b Rorr D or d Compute the Factorial value Compute the flBonacci number Compute square Roots Compute oDd numbers Given an integer number Given an integer index The sqrt function List odd numbers between "first" and "last" number provided The log function (See function description) L or l N or n l or O or o Q or q Compute natural Log numbers Compute NyanCat value Read from Input file Write to Output file Quit program You need to define a global program constant named "ENTRIES" which specifies the maximum calculations performed by your program. Initialize this to 10 at the beginning of your program; NOT INSIDE ANY FUNCTION. (Think about why it cannot be in a function) extern const int ENTRIES = 10 This sets up a variable that is available to be used across multiple files. Look up how to do this properly. The parameters for F/f and B/b are single integers. There are no parameters for q/Q. The parameters for O/o and I/i are names of the files you want to write to or read from. The parameters for D/d are the first and last values as integers. The parameters for R/r, L/I, N are the double values "first," "last," and "delta." These values will be inputted by the user as three doubles. When a function is called, the corresponding function must be called for all arguments values from first to last, in steps of delta. For instance, for command 'R': Scma re root nf (first You need to write a C++ program that will interactively accept commands from the user. Each command is a single character followed by one, two, or three parameters and specifies a function that needs to be performed. Your program must do the following Ask the user for the next command code-"Please enter command code : " Read the command code . If the command is illegal, print an appropriate error message "Invalid command code" . else if the command is quit, terminate the program . else ask the user for the parameters- "Please enter command parameters:" . Read the arguments Execute command Your program must continue this loop until the "quit" command is given. Commands that you need to include: Forf B or b Rorr D or d Compute the Factorial value Compute the flBonacci number Compute square Roots Compute oDd numbers Given an integer number Given an integer index The sqrt function List odd numbers between "first" and "last" number provided The log function (See function description) L or l N or n l or O or o Q or q Compute natural Log numbers Compute NyanCat value Read from Input file Write to Output file Quit program You need to define a global program constant named "ENTRIES" which specifies the maximum calculations performed by your program. Initialize this to 10 at the beginning of your program; NOT INSIDE ANY FUNCTION. (Think about why it cannot be in a function) extern const int ENTRIES = 10 This sets up a variable that is available to be used across multiple files. Look up how to do this properly. The parameters for F/f and B/b are single integers. There are no parameters for q/Q. The parameters for O/o and I/i are names of the files you want to write to or read from. The parameters for D/d are the first and last values as integers. The parameters for R/r, L/I, N are the double values "first," "last," and "delta." These values will be inputted by the user as three doubles. When a function is called, the corresponding function must be called for all arguments values from first to last, in steps of delta. For instance, for command 'R': Scma re root nf (first

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions