RSS Forums RSS
Please support our C advertiser: Programming Forums
Views: 3165 | Replies: 13 | Solved | Thread Tools  Display Modes
Join Date: Oct 2007
Posts: 26
Reputation: bobei89 is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 0
bobei89's Avatar
bobei89 bobei89 is offline Offline
Light Poster

Help Program calculate letter occurence in a sentence

  #1  
Oct 20th, 2007
Please help~ i stuck in this question so long time... This assignment is need to hand up due tomorrow >.<''' . Once again i confuse about array. Please correct me and show me some tips ya. Any of ur attention will be 'God Bless You'.
Here is my coding>>>
  1. #include<stdio.h>
  2.  
  3. void main()
  4. {
  5. char str[51];
  6. char letter[27]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
  7. int count, i;
  8.  
  9. printf("Enter sentence or phrase>>>");
  10. fgets(str, 51, stdin);
  11. for(count=0;str[count]!='\0';count++)
  12. {
  13. for(i=0; letter[i]; i++)
  14. if(letter[i]==str[count])
  15. letter[i]++;
  16. }
AddThis Social Bookmark Button
Reply With Quote  

Only community members can participate in forum threads. You must register or log in to contribute.



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 2:24 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC