Archive for April, 2009

Management and Entrepreneurship , Unit 3, VTU

// April 14th, 2009 // Comments // Old

Organizing and Staffing

  • Nature and purpose of organization
  • Principles of organization
  • Types of organization
  • Departmentation
  • Committees
  • Centralization VsDecentralization of authority and responsibility
  • Span of control –
  • MBO and MBE (Meaning only)
  • Nature and importance of Staffing
  • Process of Selection & Recruitment (in brief)

Management and Entrepreneurship , Unit 3

File Structure ( FS ) Lab Program 5 ( 6th Semester Information Science)

// April 9th, 2009 // Comments // Old

#include<iostream.h>
#include<string.h>
#include<fstream.h>
#include<stdlib.h>
#include<conio.h>

class record
{
public: char age[5],sem[5];
char usn[20], name[20], branch[5];
} rec[20];

char st_no[5];
int no;

void retrieve_details()
{
fstream file2;
char name[20],usn[20],branch[5];
char age[5],sem[5],ind[5];

file2.open(“record.txt”,ios::in);
for(int i=0;i<no;i++)
{
file2.getline(ind,5,’|’);
file2.getline(usn,20,’|’);
file2.getline(name,20,’|’);
file2.getline(age,5,’|’);
file2.getline(sem,5,’|’);
file2.getline(branch,5,’n’);
if(strcmp(ind,st_no)==0)
{
cout<<“nn”<<“Student details: “;
cout<<“n USNttNAMEttAGEttSEMttBRANCHn”;
cout<<“n”<<usn<<“tt”<<name<<“tt”<<age<<“tt”<<sem<<“tt”<<branch<<“n”;
}
}
file2.close();
}

void delete_record(char usno[])
{
int i;
fstream file1,file2;
char age[5],sem[5],name[20],usn[20],branch[5],ind[5];
file2.open(“record.txt”,ios::in);
for(i=0;i<no;i++)
{
file2.getline(ind,5,’|’);
file2.getline(usn,20,’|’);
file2.getline(name,20,’|’);
file2.getline(age,5,’|’);
file2.getline(sem,5,’|’);
file2.getline(branch,5,’n’);
strcpy(rec[i].usn,usn);
strcpy(rec[i].name,name);
strcpy(rec[i].age,age);
strcpy(rec[i].sem,sem);
strcpy(rec[i].branch,branch);
}
int flag=-1;
for(i=0;i<no;i++)
{
if(strcmp(rec[i].usn,usno)==0)
flag=i;
}
if(flag==-1)
{
cout<<“Error!!!n”;
return;
}
if(flag==(no-1))
{
no–;
cout<<“Deleted!!!n”;
return;
}
for(i=flag;i<no;i++)
{
rec[i]=rec[i+1];
}
no–;
cout<<“Deleted!!!n”;
file2.close();

file1.open(“index.txt”,ios::out);
file2.open(“record.txt”,ios::out);
for(i=0;i<no;i++)
{
file1<<rec[i].usn<<“|”<<i<<“n”;
file2<<i<<“|”<<rec[i].usn<<“|”<<rec[i].name<<“|”<<rec[i].age<<“|”<<rec[i].sem<<“|”<<rec[i].branch<<“n”;
}
file1.close();
file2.close();
return;
}

int main()
{
fstream file1,file2;
clrscr();
int ch,i,flag,flag1;
char rt_usn[20],st_usn[20];
char ind[5],name[20],age[5],sem[5],branch[5];
file1.open(“index.txt”,ios::out);
file2.open(“record.txt”,ios::out);
if(!file1||!file2)
{
cout<<“File creation Error!n”;
exit(0);
}

for(;;)
{
cout<<“Enter your choice: n 1. Add Recordn 2. Search Recordn 3.Delete Recordn 4.Display recordn”;
cin>>ch;
switch(ch)
{
case 1:cout<<“Enter the no. of studentsn”;
cin>>no;
cout<<“Enter the details :n”;
for(i=0;i<no;i++)
{
cout<<“n Name :”;
cin>>rec[i].name;
cout<<“n Age :”;
cin>>rec[i].age;
cout<<“n USN :”;
cin>>rec[i].usn;
cout<<“n Semester :”;
cin>>rec[i].sem;
cout<<“n Branch :”;
cin>>rec[i].branch;
file1<<rec[i].usn<<“|”<<i<<“n”;
file2<<i<<“|”<<rec[i].usn<<“|”<<rec[i].name<<“|”<<rec[i].age<<“|”<<rec[i].sem<<“|”<<rec[i].branch<<“n”;
}
file1.close();
file2.close();
break;

case 2: cout<<” Enter the usn of the student whose record is to be displayedn”;
cin>>st_usn;
file1.open(“index.txt”,ios::in);
if(!file1)
{
cout<<“Error !!!n”;
exit(0);
}
flag1=0;
for(i=0;i<no;i++)
{
file1.getline(rt_usn,20,’|’);
file1.getline(st_no,5,’n’);
if(strcmp(st_usn,rt_usn)==0)
{
retrieve_details();
flag1=1;
}
}
if(!flag1)
cout<<“Record not foundn”;
file1.close();
break;
case 3: cout<<” Enter the USN of the student whose record is to be deletedn”;
cin>>st_usn;
file1.open(“index.txt”,ios::in);
if(!file1)
{
cout<<“Error!!!n”;
exit(0);
}
flag=0;
for(i=0;i<no;i++)
{
file1.getline(rt_usn,20,’|’);
file1.getline(st_no,5,’n’);
if(strcmp(st_usn,rt_usn)==0)
{
delete_record(rt_usn);
flag=1;
}
}
if(!flag)

cout<<“Deletion failedn”;
file1.close();
break;

case 4: cout<<“Student Details :nn”;
cout<<“n USNttNAMEttAGEttSEMttBRANCHn”;
for(i=0;i<no;i++)
{
cout<<“n”<<rec[i].usn<<“tt”<<rec[i].name<<“tt”<<rec[i].age<<“tt”<<rec[i].sem<<“tt”<<rec[i].branch<<“n”;
}
break;
default: cout<<“Invalid Choice!!!!!n”;
exit(0);
break;
}
}
}

File Structure ( FS ) Lab Program 4 ( 6th Semester Information Science)

// April 5th, 2009 // Comments // Old

#include<iostream.h>
#include<stdlib.h>
#include<fstream.h>
#include<conio.h>

#include<string.h>

class student
{
public: char name[15],usn[15],age[5],sem[5],branch[15],buffer[100];
};

void search()
{
char usn[15];
int i=0;
student s1[100];
cout<<“n Enter the usn to be searched”;
cin>>usn;
fstream in;
in.open(“student.txt”,ios::in);
if(!in)
{
cout<<“n Cannot open the file in output mode”;
getch();
exit(0);
}

i=0;
cout<<“NametUsntAgetSemtBranch”;
while(!in.eof())
{
in.getline(s1[i].name,15,’|’);
in.getline(s1[i].usn,15,’|’);
in.getline(s1[i].age,5,’|’);
in.getline(s1[i].sem,5,’|’);
in.getline(s1[i].branch,15,’n’);
i++;
}

for(int j=0;j<i;j++)
{
if(strcmp(usn,s1[j].usn)==0)
{
cout<<“Record Foundn”;
cout<<“n”<<s1[j].name<<“t”<<s1[j].usn<<“t”<<s1[j].age<<“t”<<s1[j].sem<<“t”<<s1[j].branch;
return;
}
}
cout<<“n Record not found”;
return;
}

void writerecord()
{
fstream app;
student s;
app.open(“student.txt”,ios::app);
if(!app)
{
cout<<” Cannot open the file in output mode”;
getch();
exit(0);
}

cout<<“nenter the student name =”;
cin>>s.name;
cout<<“nEnter the usn =”;
cin>>s.usn;
cout<<“n Enter the age = “;
cin>>s.age;
cout<<“n Enter the sem =” ;
cin>>s.sem;
cout<<“n Enter the branch =”;
cin>>s.branch;

strcpy(s.buffer,s.name);
strcat(s.buffer,”|”);
strcat(s.buffer,s.usn);
strcat(s.buffer,”|”);
strcat(s.buffer,s.age);
strcat(s.buffer,”|”);
strcat(s.buffer,s.sem);
strcat(s.buffer,”|”);
strcat(s.buffer,s.branch);
strcat(s.buffer,”n”);

app<<s.buffer;

app.close();
}

void main()
{
clrscr();
int ch;
fstream out;
out.open(“student.txt”,ios::out);
if(!out)
{
cout<<“Cannot open the file in output mode”;
getch();
exit(0);
}

out.close();
for(;;)
{
cout<<“n1. Insert”;
cout<<“n2. Search”;
cout<<“n3. Exit”;

cout<<“Enter the choice : “;
cin>>ch;

switch(ch)
{
case 1: writerecord(); break;
case 2: search(); break;
case 3: exit(0);
default: cout<< “n Invalid Choice”;

}
}
}