Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

pgm to find number of words starting with capital letters
in a file(additional memory usage not allowed)(if a word
starting with capital also next letter in word is capital
cann't be counted twice)

Answer Posted / vadivelt

I havent write the code to read the no of words starts with
capital letter for a file. But for normal sentence given as
input.


#include<stdio.h>
#include<conio.h>

int main()
{
char *ptr;
int count = 0;
ptr = (char *)malloc(200);
printf("ENTER THE SENTENCE\n");
ptr = gets(ptr);
while(*ptr != '\0')
{
/*This condition is used for the first word
in the sentence*/
if(count == 0 && (*ptr >=65 && *ptr <= 90))
{
count++;
}
else if(*(ptr-1) == ' ' && (*ptr >=65 &&
*ptr <= 90))
{
count++;
}
ptr++;
}
printf("\nNO OF WORDS STARTS WITH CAPITAL LETTER
IS: %d\n", count);
getch();
}

Is This Answer Correct ?    7 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is character set?

1115


What are the functions to open and close file in c language?

1127


Explain why can’t constant values be used to define an array’s initial size?

1303


Are comments included during the compilation stage and placed in the EXE file as well?

1028


How do you define a function?

969


What is the use of typedef in c?

989


How to explain the final year project as a fresher please answer with sample project

908


What is #include stdio h?

1058


What is the -> in c?

954


In the DOS enveronment, normal RAM that resides beyond the 1mb mark. a) expanded memory b) swapped memory c) Extended memory d) none

1157


What is bubble sort technique in c?

931


When c language was developed?

1010


Explain high-order and low-order bytes.

1046


Explain enumerated types.

974


Is using exit() the same as using return?

1246