untitled
My sites
Home
Plus Two
Plus One
About Author
Your Voice
Brother's Site
First Home
Kerala Links
Indian Links
Indian Fonts
Site Submission
Thss,Mlpy
Plus Two Programs
Index of programs:Set 6
More on strings
Find vowels in a text
Find vowels in a text file
Reverse a string and copy one string to another without using functions but class
Count number of words.A simple one
<<
Previous
#include
#include
#include
#include
#include
/* Author : Rohith.R Email : rrohithr@gmail.com Category : Begineer Program : Just find number of vowels in a text Meant For : Plus Two students,Kerala */ void main() { clrscr(); int v=0; cout<<"\n Enter string"; gets(text); for(int i=0;text[i]!='\0';i++) { text[i]=toupper(text[i]); // Converting to upper case switch(text[i]) { case 'A': case 'E': case 'I': case 'O': case 'U': v++; } } cout<<"\n Number of vowels in string is"<
Program 2:
#include
#include
#include
#include
/* Author : Rohith.R Email : rrohithr@gmail.com Category : Begineer Program : Read text from file and count vowels Meant For : Plus Two students,Kerala */ void main() { char ch; clrscr(); ifstream infile("vowel"); int v=0; cout<<"\nText:"; while(infile) { infile.get(ch); ch=toupper(ch); switch(ch) { case 'A': case 'E': case 'I': case 'O': case 'U': v=v+1; } } cout<<"\n Number of vowels"<
Program 3:
#include
#include
#include
#include
/* Author : Rohith.R Email : rrohithr@gmail.com Category : Begineer Program : String reverse and copy using class and with no builtin functions Meant For : Plus Two students,Kerala */ class STRING { char text[100]; public: void reader(); void printer(); void dstrrev(); void dstrcpy(); }; void STRING::reader() { cout<<"\n Enter string"; gets(text); } void STRING::printer() { cout<<"\n The string is"<
=0;--i,j++) str[j]=text[i]; str[j]='\0'; cout<<"i and j are respectively"<
>option; switch(option) { case 1: s.dstrrev(); break; case 2: s.dstrcpy(); break; case 3: s.printer(); break; default: cout<<"\n Invalid choice"; } getch(); }while(option<4); }
Program 4:
#include
#include
#include
/* Author : Rohith.R Email : rrohithr@gmail.com Category : Begineer Program : To find the number of words .Simple not considering too many options available Meant For : Plus Two students,Kerala */ void main() { int ns=0,nw=0,nb=0; char text[50]; cout<<"\n Enter a text"; gets(text); if(text[0]==32) nw=-1; for(int i=0;text[i]!='\0';i++) if(text[i]==32&&text[i+1]!=32)//ascii code for blank space is 32 ns++; nw+=ns+1; nb=i-ns; cout<<"\n Number of words"<
Go home
Web Hosting
·
Blog
·
Guestbooks
·
Message Forums
·
Mailing Lists
Easiest Website Builder ever!
·
Build your own toolbar
·
Free Talking Character
·
Email Marketing
powered by
bravenet.com