THIS IS FOR ALL 1ST AND 2ND YEAR ENGINEERING STUDENTS ..... HOPE U ALL R BENEFITED FROM IT...............:)))))
Saturday, 28 December 2013
Monday, 30 September 2013
Check validity of entered sequence
#include<iostream>
using namespace std;
#include<conio.h>
void main()
{
char a[20];
int i,j,x,s=1,cou=0;
cout<<"Enter the sequence";
cin>>a;
for(i=0;a[i]!='\0';i++)
{ switch(s)
{
case 1:if(a[i]=='0')
{
s=2; cou=1;
break;
}
else
{ cou=0; break;}
break;
case 2:if(a[i]=='0')
{
s=3; cou=1;
break;
}
else
{ cou=0; break;}
break;
case 3:if(a[i]=='0')
{
s=3;
cou=1;
break;
}
else if(a[i]=='1')
{
s=4;
cou=1;
break;
}
else
{cou=0; break; }
break;
case 4:if(a[i]=='0')
{
s=3;
cou=1;
break;
}
else if(a[i]=='1')
{
s=5; cou=1;
break;
}
else
{ cou=0;break; }
break;
case 5:if(a[i]=='0')
{
s=3; cou=1;
break;
}
else if(a[i]=='1')
{
s=5; cou=1;
break;
}
else
{ cou=0; break;}
break;
}
if(cou==0)
{break;}
}
if(cou==0) { cout<<"Not
Valid";}
else if(cou==1) { cout<<"Valid"; }
getch();
}
Enter
the sequence 001011011
Valid
Enter
the sequence 111001010
Not
Valid
Check validity of a string
#include<iostream>
#include<string.h>
using
namespace std;
void
main()
{
char st[20];
int state=0,le,i=0,f=0,flg=0;
cout<<"Enter a sting : ";
gets(st);
le=strlen(st);
do
{
char c=st[i];
switch(state)
{
case 0: if(c=='0')
{
state=0;
le--; flg=0;
}
else if(c=='1')
{
state=1;
le--; flg=0;
}
else
{ f=1; break; }
break;
case 1: if(c=='0'||c=='1')
{
state=2;
le--; flg=1;
}
else
{ f=1; break; }
break;
case 2: if(c=='0'||c=='1')
{
state=2;
le--; flg=2;
}
else
{ f=1; break; }
break;
} i++;
}
while(le!=0 && f!=1);
if(le==0 && flg==2)
{ cout<<"valid input"; }
else
{ cout<<"invalid input";
}
}
Enter
a sting : 1011010
valid
input Press any key to continue . . .
Please note : This tricks will not
harm your computer in anyway.
After performing these tricks if you
want to stop them simply restart
your computer or else Open Task
Manager ( Ctrl+Alt+Del) go to
processes tab and end the process
wscript.exe.
Toggle Caps Lock button On-Off
Continuously :
Open Notepad.
Copy the following code.
Set wshShell =wscript.Create Object
("WScript .Shell")
do
wscript.sleep 100
wshshell.sendke ys "{CAPSLOCK}"
loop
Save it as abc.vbs ...... ENJOY..!!.
harm your computer in anyway.
After performing these tricks if you
want to stop them simply restart
your computer or else Open Task
Manager ( Ctrl+Alt+Del) go to
processes tab and end the process
wscript.exe.
Toggle Caps Lock button On-Off
Continuously :
Open Notepad.
Copy the following code.
Set wshShell =wscript.Create Object
("WScript .Shell")
do
wscript.sleep 100
wshshell.sendke ys "{CAPSLOCK}"
loop
Save it as abc.vbs ...... ENJOY..!!.
Subscribe to:
Posts (Atom)