A simple program that I wrote using Delphi as my programming language that will ask the user to give a string, phrase, sentence or word and then our program will count the number of vowels from the given word, string, phrase or sentence from the user. The code is very simple, short and easy to understand.
Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
Program Sample Output
Program Listing
unit vowels_remove;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
Button1: TButton;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
var
St, New: String[255];
Location: integer;
Count: integer;
Valid_Ch: Set of Char;
procedure TForm1.Button1Click(Sender: TObject);
begin
Count := 0;
st := edit1.text;
Valid_Ch := ['A', 'E', 'I', 'O', 'U', 'a', 'e', 'i', 'o', 'u'];
For Location := 1 to Length(st) Do
If St[Location] IN Valid_Ch Then Count := SUCC(Count);
label3.caption := 'The Number of Vowels is ' + inttostr(count)+ '.';
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
edit1.text := '';
label3.caption :='';
edit1.setfocus;
end;
end.
No comments:
Post a Comment