Unit Unit1

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

unit Unit1;

interface

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls;

type

TForm1 = class(TForm)

Label1: TLabel;

Label2: TLabel;

Edit1: TEdit;

Edit2: TEdit;

Button1: TButton;

Button2: TButton;

Label3: TLabel;

Label4: TLabel;

procedure Button1Click(Sender: TObject);

procedure Button2Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form1: TForm1;

implementation
{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);

var

c:char;

w:string;

posi:integer;

begin

w:= edit1.text;

c:= edit2.Text[1];

posi:=pos(c,w);

label3.Caption:= inttostr(posi);

end;

procedure TForm1.Button2Click(Sender: TObject);

var

st, new: string;

sSentence:string;

i,iCount:integer;

valid_cha:Set of Char;

location: integer;
begin

st:=edit1.Text;

icount:=0;

valid_cha:=['A','E','I','O','U','a','e','i','o','u'];

For LOCATION :=1 to length(st) do

begin

if st[location] IN valid_cha then icount:= SUCC(icount);

label4.caption:= 'THE Number of Vowels is'+inttostr(icount)+'';

end;

end;

end.

You might also like