Monday, July 23, 2007

HECTIC day

The day started with SIVAJI ringtone and that too 5 am.Today,I went along wth GAWDE to passport office for his passport application.Mom asked me to have a tea ,i said big no to beloved tea,in the spree of reaching kurla station.I took rickshow,and the bhayya guy played his typical bhojpuri songs.I told him to stop the non sense,he replied wth bhaisaab gaana nahi lagaya to gadi chalana mushkil hota hai..Now is this a great reason to play the music?..what shall I say to the guy.I paid the fare and leave the rickshow.
I thought to buy the ticket to dadar.But,next thought was who will catch me in the morning,so I left the ticket issue.I always prefer to buy the ticket instead of taking the risk.Its better to pay 10rs than 250rs.But,in the morning no TC is seen on stations.The government should do something to collect fare from the guys like me and thousands.Think how much money they can make!
It was such an unusual day,my friend GAWDE came on time,its been years I haven't seen him on time.After reaching there..i arranged gawdes papers and people were lookin towards me like as an i am an agent.Me and gawde also thought to have this business.

Monday, August 28, 2006

CPL TW#3 refined

// Adjust the number of students by replacing 3 by any value u want
#include
#include
#include

class STUDENT
{
private :
int rollno,m1,m2,m3,ttl;
char gr;
char name[31];
public :
void getdata();
void dispdata();
friend void list(STUDENT*);
};
void STUDENT :: getdata()
{
cout << "ENTER DATA IN SEQUENCE OF ROLLNO,NAME,MARKS IN 3 SUBJECTS :";
cin >> rollno >> name >> m1 >> m2 >> m3;
ttl=m1+m2+m3;
if(ttl>=180)
{
gr='A';
}
if(ttl<180 && (ttl>=150))
{
gr='B';
}
if(ttl<150 && (ttl>=105))
{
gr='C';
}
if(ttl<105)
{
gr='D';
}
}
void STUDENT :: dispdata()
{
cout << "DATA :";
cout << rollno << " " << name << " " << m1 << " " << m2 << " " << m3 << " " << ttl << " " << gr << endl;
}
void list(STUDENT s[])
{
int n=3;
int i,j,pass,swtch=1;
STUDENT temp;
for(pass=1;pass {
for(i=0;i { swtch=0;
if(s[i].ttl {
temp=s[i];
s[i]=s[i+1];
s[i+1]=temp;
swtch=1;
}
}

}

}
void main()
{
STUDENT s1[3];
STUDENT s[3];
int i;

ofstream f2 ("trial.bf",ios::binary);
if(!f2)
{
cout << "Can not open the file";
getch();
};

for(i=0;i<3;i++)
{
s[i].getdata();
s[i].dispdata();
}
list(s);
for(i=0;i<3;i++)
{
f2.write((char *) &s[i],sizeof(STUDENT));
}
cout << "File is created" << endl;
f2.close();

ifstream f1 ("trial.bf");
if(!f1)
{
cout <<"can not open the file";
}
f1.read((char*) &s1,sizeof(s1));
cout << "Reading is complete:";
cout << endl << "WELCOME";
cout << endl << "LIST IS" << endl;
list(s);
for(i=0;i<3;i++)
{
s1[i].dispdata();
}
getch();
}
/*
********OUTPUT***********
ENTER DATA IN SEQUENCE OF ROLLNO,NAME,MARKS IN 3 SUBJECTS :126
FRANK
78
87
60
DATA :126 FRANK 78 87 60 225 A
ENTER DATA IN SEQUENCE OF ROLLNO,NAME,MARKS IN 3 SUBJECTS :120
RON
56
54
50
DATA :120 RON 56 54 50 160 B
ENTER DATA IN SEQUENCE OF ROLLNO,NAME,MARKS IN 3 SUBJECTS :134
RIA
80
89
90
DATA :134 RIA 80 89 90 259 A
File is created
Reading is complete:
WELCOME
LIST IS
DATA :134 RIA 80 89 90 259 A
DATA :126 FRANK 78 87 60 225 A
DATA :120 RON 56 54 50 160 B
*/



The BINARY FILE CREATED—TRIAL.BF

† P Y Z ARIA ¬ À“0 z òÿ
7z Ä ¬ …#~ N W < á AFRANK À“0 | òÿ
7| Æ ® …#x 8 6 2 BRON ž
D z
Ä ¬ Ä ¸ä •

She is the girl


She is the girl
That laughs at me
She is the girl
That sweets me off my feet
She is the girl
Thats good at all sports
She is the gurl
I stare at in those spandex shorts
She is the girl
That controls the courts
She is the girl
That has guys from all sorts
She is the girl
Thats related to VJ
She is the girl
That is so nice and sweet
She is the girl
That I will take by the hand
She is the one to whom ill be sayin
Will you marry me sam
She is the girl
I am waiting for
She is the girl
Yet hidden and enclosed

CPL TW5

TW#5

#include
#include
#include
#include
class matrix
{
private:
int a[5][5],b[5][5],c[5][5];
int i,j,k,m,n,p,q;
public:
void getdata()
{

cout<<"Enter max. rows in matrix a:";
cin>>m;
cout<<"Enter max. columns in matrix a:";
cin>>n;
cout<<"Enter max. rows in matrix b:";
cin>>p;
cout<<"Enter max. columns in matrix b";
cin>>q;
if(n!=p)
{
cout<<"Multiplication not possible";
getch();
exit(0);
}
else
{
cout<<"\nMatrix A:";
i=0,j=0;
for(i=0;i for(j=0;j {
cout<<"enter element "< cin>>a[i][j];
}
cout<<"\nMatrix B:";
i=0,j=0;
for(i=0;i for(j=0;j {
cout<<"enter element "< cin>>b[i][j];
}
}


}
void cal()
{
for(i=0;i<5;i++)
for(j=0;j<5;j++)
c[i][j]=0;

for(i=0;i for(j=0;j for(k=0;k c[i][j]=c[i][j]+a[i][k]*b[k][j];
}

void display()
{
cout<<"\nMatrix A:" << endl;
for(i=0;i {
for(j=0;j {

cout< }
cout << endl;
}
cout<<"\nMatrix B:"<< endl;
for(i=0;i {
for(j=0;j {
cout< }
cout << endl;
}
cout<<"\nResultant Matrix is:"<< endl;
for(i=0;i {
for(j=0;j {
cout< }
cout << endl;
}
}

};
void main()
{
clrscr();
matrix m1;
ofstream f1("c:\\matrix.txt",ios::out);
if(!f1)
{
cout<<"Cannot open the file";
getch();
}
m1.getdata();
m1.cal();
f1.write((char *) & m1,sizeof(m1));
cout<<"\nFile Created";
f1.close();

ifstream f2("c:\\matrix.txt");
if(!f2)
{
cout<<"Cannot open file";
getch();
}
f2.read((char *) & m1,sizeof(m1));
m1.display();
f2.close();

getch();

}
/*
Enter max. rows in matrix a:3
Enter max. columns in matrix a:3
Enter max. rows in matrix b:3
Enter max. columns in matrix b3

Matrix A:enter element 1,1?1
enter element 1,2?0
enter element 1,3?0
enter element 2,1?0
enter element 2,2?1
enter element 2,3?0
enter element 3,1?0
enter element 3,2?0
enter element 3,3?1

Matrix B:enter element 1,1?1
enter element 1,2?2
enter element 1,3?3
enter element 2,1?4
enter element 2,2?5
enter element 2,3?6
enter element 3,1?7
enter element 3,2?8
enter element 3,3?9

File Created
Matrix A:
1 0 0
0 1 0
0 0 1

Matrix B:
1 2 3
4 5 6
7 8 9

Resultant Matrix is:
1 2 3
4 5 6
7 8 9
*/

CPL TW3

TW#3
// Adjust the number of students by replacing 3 by any value u want
#include
#include
#include

class STUDENT
{
private :
int rollno,m1,m2,m3,ttl;
char gr;
char name[31];
public :
void getdata();
void dispdata();
friend void list(STUDENT*);
};
void STUDENT :: getdata()
{
cout << "ENTER DATA IN SEQUENCE OF ROLLNO,NAME,MARKS IN 3 SUBJECTS :";
cin >> rollno >> name >> m1 >> m2 >> m3;
ttl=m1+m2+m3;
if(ttl>=180)
{
gr='A';
}
if(ttl<180 && (ttl>=150))
{
gr='B';
}
if(ttl<150 && (ttl>=105))
{
gr='C';
}
if(ttl<105)
{
gr='D';
}
}
void STUDENT :: dispdata()
{
cout << "DATA :";
cout << rollno << " " << name << " " << m1 << " " << m2 << " " << m3 << " " << ttl << " " << gr << endl;
}
void list(STUDENT s[])
{
int n=3;
int i,j,pass,swtch=1;
STUDENT temp;
for(pass=1;pass {
for(i=0;i { swtch=0;
if(s[i].ttl {
temp=s[i];
s[i]=s[i+1];
s[i+1]=temp;
swtch=1;
}
}

}

}
void main()
{
STUDENT s1;
STUDENT s[3];
int i;

ofstream f2 ("trial.bf",ios::binary);
if(!f2)
{
cout << "Can not open the file";
getch();
};

for(i=0;i<3;i++)
{
s[i].getdata();
s[i].dispdata();
}
list(s);
for(i=0;i<3;i++)
{
f2.write((char *) &s[i],sizeof(STUDENT));
}
cout << "File is created" << endl;
f2.close();

ifstream f1 ("trial.bf");
if(!f1)
{
cout <<"can not open the file";
}
f1.read((char*) &s,sizeof(s));
cout << "Reading is complete:";
cout << endl << "WELCOME";
cout << endl << "LIST IS" << endl;
list(s);
for(i=0;i<3;i++)
{
s[i].dispdata();
}
getch();
}
/*
********OUTPUT***********
ENTER DATA IN SEQUENCE OF ROLLNO,NAME,MARKS IN 3 SUBJECTS :126
FRANK
78
87
60
DATA :126 FRANK 78 87 60 225 A
ENTER DATA IN SEQUENCE OF ROLLNO,NAME,MARKS IN 3 SUBJECTS :120
RON
56
54
50
DATA :120 RON 56 54 50 160 B
ENTER DATA IN SEQUENCE OF ROLLNO,NAME,MARKS IN 3 SUBJECTS :134
RIA
80
89
90
DATA :134 RIA 80 89 90 259 A
File is created
Reading is complete:
WELCOME
LIST IS
DATA :134 RIA 80 89 90 259 A
DATA :126 FRANK 78 87 60 225 A
DATA :120 RON 56 54 50 160 B
*/
The BINARY FILE CREATED—TRIAL.BF

† P Y Z ARIA ¬ À“0 z òÿ
7z Ä ¬ …#~ N W < á AFRANK À“0 | òÿ
7| Æ ® …#x 8 6 2 BRON ž
D z
Ä ¬ Ä ¸ä •

CPL TW2

TW#2

#include
#include

class string
{
private :
int len;
char a[80];
public:
void getdata();
void display();
friend string operator+( string s1 , string s2);
friend void copy();
friend void paly();
friend void rever();
};
void string :: getdata()
{
cout << "ENTER THE STRING:";
cin >> a;
int i;
i=0;
while((a[i]!='\0') && (i<80) )
{
i++;
}
len=i;
}

void string :: display()
{
cout << endl << a;
}

string operator+( string s1, string s2)
{
string s;
char str[25],str1[10],str2[10];
char *p,*p1;
int len1,len2;
len1=s1.len;
len2=s2.len;
int i,j;


p=s1.a; p1=s2.a;


for(i=0;i<25;i++)
s.a[i]=0;

cout<<"STRING IS:";
for(i=0;i s.a[i]=*(p+i);

for(j=0;j {
s.a[i]=*(p1+j);
i++;
}


s.len=len1+len2;
return s;
}

void copy()
{
string s1,s2;
char str1[20],str2[20],*p,*p1;
int i;
cout<<"WELCOME TO COPY THE STRING";
s1.getdata();

p=s1.a;

for(i=0;i<20;i++)
s2.a[i]=0;
cout<<"THE COPIED STRING IS:";
for(i=0;i s2.a[i]=*(p+i);

cout<}

void paly ()
{
string s;
int flag=0,i,len=0;
char str[50],*p;
cout << "WELCOME TO TEST THE PALINDROME PROPERTY" << endl ;
s.getdata();
p=s.a;


for(i=0;i {
if(*(p+i)!=*(p+(s.len-i-1)))
flag++;
}
if(flag==0)
cout<<"\nTHE STRING IS PALINDROME.";
else
cout<<"\nTHE STRING IS NOT PALINDROME.";
}
void rever()
{
string s;
char str[10];
char *p,*p1;
int len=0,i;
cout << "WELCOME TO REVERSE THE STRING " << endl ;
s.getdata();

p1=s.a;
cout<<"REVERSED STRING IS:";
for(i=s.len;i>=0;i--)
cout<<*(p1+i);
getch();
}

void main()
{
string p,q,r;
int i,j;
int c;
clrscr();
cout << "WELCOME";
do {
cout << endl << "1.Read & display a string.";
cout << endl << "2.Reverse a string";
cout << endl << "3.Copy the string";
cout << endl << "4.Concatenate the strings";
cout << endl << "5.To test property Palindrome";
cout << endl << "6.Exit";
cout << endl << "Enter ur choice:";
cin >> c;

switch(c)
{
case 1 :
p.getdata();
cout << "Entered string is : " << endl;
p.display();
break;
case 2 :
rever();
break;
case 3 :
copy();
break;
case 4 :
p.getdata();
q.getdata();
cout << "ENTERED DATA IS:";
p.display();
cout << endl;
q.display();
(p+q).display();
break;
case 5 :
paly();
break;
}
}
while(c!=6);
}
/*
WELCOME
1.Read & display a string.
2.Reverse a string
3.Copy the string
4.Concatenate the strings
5.To test property Palindrome
6.Exit
Enter ur choice:1
ENTER THE STRING:INDIA
Entered string is :

INDIA
1.Read & display a string.
2.Reverse a string
3.Copy the string
4.Concatenate the strings
5.To test property Palindrome
6.Exit
Enter ur choice:2
WELCOME TO REVERSE THE STRING
ENTER THE STRING:COMPUTER
REVERSED STRING IS: PUTER
1.Read & display a string.
2.Reverse a string
3.Copy the string
4.Concatenate the strings
5.To test property Palindrome
6.Exit
Enter ur choice:3
WELCOME TO COPY THE STRINGENTER THE STRING:PARADISE
THE COPIED STRING IS:PARADISE
1.Read & display a string.
2.Reverse a string
3.Copy the string
4.Concatenate the strings
5.To test property Palindrome
6.Exit
Enter ur choice:4
ENTER THE STRING:Mr.
ENTER THE STRING:RON
ENTERED DATA IS:
Mr.

RON
STRING IS:
Mr.RON
1.Read & display a string.
2.Reverse a string
3.Copy the string
4.Concatenate the strings
5.To test property Palindrome
6.Exit
Enter ur choice:5
WELCOME TO TEST THE PALINDROME PROPERTY
ENTER THE STRING:appa

THE STRING IS PALINDROME.
1.Read & display a string.
2.Reverse a string
3.Copy the string
4.Concatenate the strings
5.To test property Palindrome
6.Exit
Enter ur choice:5
WELCOME TO TEST THE PALINDROME PROPERTY
ENTER THE STRING:new

THE STRING IS NOT PALINDROME.
1.Read & display a string.
2.Reverse a string
3.Copy the string
4.Concatenate the strings
5.To test property Palindrome
6.Exit
Enter ur choice:6
*/