Showing posts from July, 2012

Create a class Distance containing Feet and Inches as data members. Write a C++ program to read distance from user, store it in the file and to read it from the file and display it to the user. Use operator overloading for the following: 1. << to write distance object in inches format to a file 2. >> to read inches from File.

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

Write a menu driven C++ program using class to calculate Area and Volume of rectangle using inline function.

#include<iostream.h> #include<conio.h> class Rectangle {   i…

Create a class MyFile containing: - FILE *fp; - Char fn[maxsize]; Write necessary member Functions using operator overloading: 1. + F3=F1+F2 Put contents of F1 and F2 in F3. 2. - -F3 Changes the case of all upper and lower case characters in F3.

#include<iostream.h> #include<fstream.h> #include<string.h&g…

Consider the following Class mystring { char str [100]; Public: // methods }; Overload operator “!” to reverse the case of each alphabet in the string.

#include<iostream.h> #include<string.h> #include<ctype.h> …

Create a class currency containing rupees and paise as data members. Write necessary member functions using operator overloading for the following: 1. currency (long int rup=0,int paise=0) 2. currency & operator += (currency &) (to add one currency to another) 3. currency & operator - = (currency &) (to subtract one currency from another) Accept Rupee & paise from user and display it.

#include<iostream.h> #include<conio.h> class currency {   lo…

Create a C++ class for a student object with the following attributes—roll no, name, number of subjects , marks of subjects. The number of subjects varies for each student. Write a parameterized constructor which initializes roll number, name and number of subject and creates the array for marks dynamically, write member function for accepting marks and display all information of student.

#include<iostream.h> #include<string.h> #include<conio.h>…

Write a C++ program to find area of triangle, circle, and rectangle using function overloading.

#include<iostream.h> #include<conio.h> void area(int r) {   …

Consider a class point containing x and y coordinates. Write necessary functions for the following cases: 1. to accept a point 2. to display it 3. to find distance between two points using operator overloading (-) (Use friend function)

#include<iostream.h> #include<conio.h> class point {   int x…

Write a program to read the contents from the file “sample.txt”. Store all the characters from “sample.txt” into the file “character.txt” & store all digits into the file “digit.txt

#include<fstream.h> #include<ctype.h> #include<conio.h> …

Write a C++ program which will find the maximum of 3 integer numbers and maximum of 3 float numbers using function overloading.

#include<iostream.h> #include<conio.h> void max(int a,int b,in…

Create a class Student having data members: - RollNo - Name - Marks Write necessary member functions : 1. to accept the details and store it into the file “school.dat” 2. to read the details from file and display it. 3. to update a given record into the file.

#include<iostream.h> #include<process.h> #include<fstream.h…

Create a class Medicalshopee containing - medicine - qty - price Medicine details are stored into the file “medical.txt” .When any medicine has to be sold, it is first searched into the file, if found, the qty is decremented by that much qty to be sold.

#include<conio.h> #include<stdio.h> #include<string.h> #…

Load More That is All