Help Please

Mar 24, 2014 at 4:15pm
1. Write a function that receives a string of characters. This function display each character in the string with one character per line.

2. Write a function that receives a string of characters and displays all the character in the string in a reverse order.

3. Write a function that receives a string of characters and a single character. The function counts and returns the number of occurrences of this single character.

4. Write a function that receives a string of characters that contains a few words separated by blank spaces. This function has no return value. It changes the initial of each word in the string to up case letter.

5. Write a function that receives a string of characters. The function has no return value. All this function does is to delete all the blank spaces contained in the string.
Mar 24, 2014 at 4:25pm
These are all rather simple homework tasks. Please, try to write the code for them yourself.
Mar 24, 2014 at 4:41pm
tried but it's not working.. That's what I got:

int stringlength (char a[]);
{
int i=0;
while (a[i] != '\0'){
i++;
}
return i;
}

void deleteBlanks(char a[])
{
int i=0,j=0;
while(a[i]!='\0'){
if(a[i]==" "){
j=i;
while(a[j]!='\0'){
a[j]=a[j+1];
j++;
}
i++;
}

void changeToUpper (char a[])
{
int i=0;
while (a[i]!='\0'){
if(islower (a[i])
a[i]=ToUpper (a[i]);
i++;
}
}
Mar 24, 2014 at 4:46pm
What is "not working"?
Topic archived. No new replies allowed.