Work related, C/C++ Programming

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

// 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
Posted Date: 3/26/2013 8:48:53 PM | Location : United States

Related Discussions:- Work related, Assignment Help, Ask Question on Work related, Get Answer, Expert's Help, Work related Discussions

Write discussion on Work related
Your posts are moderated
Related Questions
A: Multiple providers of libraries might employ common global identifiers causing a name collision whereas an application attempt to link with two or more such libraries. The names

Write a program called A1Q3, that reads it the radius of a circle as an integer and prints the circle's diameter, circumference and area.  Use a constant value for pi.  Do all calc


I have a program and I want someone to fix it for me by using basic c language program.

write a C code that plots an object on the window and on the user''s click of mouse on the window, the object starts rotating continuously until the user presses the mouse again

Nested Classes Many a times, it becomes essential to have a class contain properties of two other classes. One way is to explain a class within another - that is a class with m

1. The shell must support the following internal commands: i. cd - Change the current default directory to . If the argument is not present, report the current directory. If t

P o i n t e r d e c l a r a t i o n f o r C l a s s : M m; M * p m; / / C la ss M i s d e c l a r e d a s

In this lab, please complete a given program to perform the following tasks: 1. Allocate a 10 by 5 2D byte array dynamically. The way of allocation must be consistent with pag

Four cells, each with an internal resistance of 0.40 ? and an e.m.f. of 2.5 V are connected in series to a load of 38.40 ?. (a) Verify the current flowing in the circuit and t