Class XII Practical List-1

advertisement
1. Define a class named ADMISSION in C++ with the following descriptions:
Private members:
AD_NO integer (Ranges 10 - 2000)
NAME Array of characters (String)
CLASS Character
FEES Float
Public Members:
• Function Read_Data ( ) to read an object of ADMISSION type
• Function Display( ) to display the details of an object
• Function Draw_Nos ( ) to choose 2 students randomly and display the
details. Use random function to generate admission nos to match with AD_NO.
2. Define a class in C++ with following description:
Private Members
• A data member Flight number of type integer
• A data member Destination of type string
• A data member Distance of type float
• A data member Fuel of type float
• A member function CALFUEL() to calculate the value of Fuel as per the
following criteria:
Distance
Fuel
<=1000
500
more than 1000 and <=2000
1100
More than 2000
2200
Public Members
" A function FEEDINFO() to enter info.
A function Display() –To display information and call CALFUEL()
3.Write a program to add the data in sequential file named STU.DAT which
contains Roll No, Name & Marks.
4.Write a program to add a string in sequential file named STORY.DAT ,
read the string and display no. of upper case and lower case letters.
5.Write a program to add a string in sequential file named Music.DAT ,
read the string and display no. of characters, spaces and digits .
6.Write a program to add records in a binary file “Library.dat” and write
functions to display and search records.
7.Given a binary file PHONE.DAT, containing records of the following
structure type
class Phonlist
{
char Name[20];
char Address[30];
char AreaCode[5];
char PhoneNo[15];
public:
void Register();
Void Show();
int CheckCode(char AC[])
{
return strcmp(AreaCode,AC);
} };
Write a function TRANSFER ( ) in C++, that would copy all those records
which are having AreaCode as “DEL” from PHONE.DAT to
PHONBACK.DAT.
8.Write a functions in C++ to add, display, delete, modify and search
records in a binary file “STUDENT.DAT”, the following class is class STUD
{
int Rno;
char Name[20];
public:
void Enter()
{
cin>>Rno;gets(Name);
}
void Display(){cout<<Rno<<Name<<endl;}
};
9. WAP to show all kinds of Inheritance using C++ code.
10. Assume a text file “coordinate.txt” is already created. Using this file
create a C++ function to count the number of words having first character
capital.
Example: Do less Thinking and pay more attention to your heart. Do
Less Acquiring and pay more Attention to what you already have. Do Less
Complaining and pay more Attention to giving. Do Less criticizing and pay
more Attention to Complementing. Do less talking and pay more attention
to SILENCE. Output will be : Total words are 16
Download