Work related, C/C++ Programming

Assignment Help:
Make the following 3 functions work by filling in appropriate C code. This file


1.
// Write a function to count the number of particular characters in a string.
// Do not use any standard library calls.
int CountCharacters(char* String, char Character)
{
//insert your code here
}

// 2.
// Write a function that reverses a string without allocating any extra storage.
void ReverseString(char* String)
{
//insert your code here
}

// 3.
// Write a function that returns the nth prime number corresponding to the number n passed.
// • Do not worry about overflow. Assume that a long will hold all required values.
// • Optimize for readability and compactness, not speed.
// • Do not use any complex math formulas to calculate it.
// • Do not use any math operators beyond addition, subtraction, multiplication, division.
// • I''m looking at your coding ability, not your math ability or your ability to go look up an algorithm on Google.
//
// Examples:
// GetPrime(1) == 2 // the first prime number is 2
// GetPrime(2) == 3 // the second prime number is 3
// GetPrime(3) == 5 // the third prime number is 5
// GetPrime(4) == 7 // the fourth prime number is 7
// GetPrime(5) == 11 // the fifth prime number is 11
// GetPrime(1000) == 7909 // the thousandth prime number is 7909
long GetPrime(long n)
{
//insert your code here
}

Related Discussions:- Work related

Define dangling pointer?, A: A dangling pointer arises while you use the ad...

A: A dangling pointer arises while you use the address of an object after its lifetime is end. It may occur in situations such as returning addresses of automatic variables from a

Programming, what is the first thing I need to know about Programming?

what is the first thing I need to know about Programming?

Restart, how to create program in c that will system restart

how to create program in c that will system restart

Program to write c++ program, program to write superposition of waves using...

program to write superposition of waves using class and objects

Pointers, When declaring a variable of data type pointer, use the * in fron...

When declaring a variable of data type pointer, use the * in front of the variable name. These variables hold a memory location (like B45CDF), not an actual value like 30 or A:

Array, #an array that accept input and gives an output

#an array that accept input and gives an output

Palindrome, A palindrome is a string that reads the same from both the ends...

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

What is the difference between = symbol and = = symbol, What is the differe...

What is the difference between = symbol and == symbol? - The = symbol is generally used in mathematical operations. It's used to assign a value to a given variable whereas the

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd