Electrofriends

C++ class program to illestrate File operations

by Ranjith | March 13th, 2010.

AIM
Write a program to illustrate the write() member function which are usually used for transfer of data blocks to the file.
ALGORITHM
1. Start the process
2. Invoke the class
a. Create two inline member functions .ie, getdata() and dispdata()
i. getdata() for input
ii. dispdata() for display
3. Open the file in fstream mode
4. Write the data in to the file
5. Slose the file
6. Stop the process
PROGRAM

#include<iostream.h>
#include<conio.h>
#include<fstream.h>
class student
{
private:
int rno;
char name[10];
float [...]

Read More..

c++ Program to illustrate the use of difference operators using friend function

by Ranjith | March 13th, 2010.

AIM:
A program to illustrate the use of difference operators to access the class member using friend function

ALGORITHM:
1) Start the process
2) Invoke the classes
3) Call the set_xy() first
a) Assign the value of x and y
b) Print the value of x and y
4) Call the sum() for second(friend)
a) Again assign the temp value of x and y
5) Print the value of x and [...]

Read More..

C++ program for implementation of class

by Ranjith | March 12th, 2010.

AIM:
A program to solve a quadratic equation, using OOP techniques.
ALGORITHM:
1) Start the process
2) Invoke the classes
3) Get the input for a,b,c;
4) Call the function getinfo() and display()
5) Check if a=0
a) True : compute c/b;
i) Print the value of a/c;
b) False: compute b*b-4*a*c;
i) If ( b*b-4*a*c)=0
ii) Call img();
iii) Otherwise : call real(a,b,c);
6) Stop the process
PROGRAM:

#include<iostream.h>
#include<conio.h>
class equation
{
private:float a,b,c;
public: void getinfo(float a, float b,float c );
void display( [...]

Read More..

Share and enjoy

    • Digg
    • Facebook
    • Technorati
    • StumbleUpon
    • Twitter
    • Reddit
    • del.icio.us
    • Yahoo! Buzz
Copyright©2009 www.electrofriends.com All Rights Reserved. Powered by Dhyeya