BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan Right Header

HOME BZU Mail Box Online Games Radio and TV Cricket All Albums
Go Back   BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan > Institute of Computing > Bachelor of Science in Information Technology > BsIT 3rd Semester > Object Oriented Programming

Object Oriented Programming By Mam Sidra Malik


Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 18-09-2008, 05:01 AM
BSIT07-01's Avatar
Addicted to Computer


 
Join Date: Sep 2007
Location: ------------
Age: 34
Posts: 1,309
Contact Number: ---------------
Program / Discipline: BSIT
Class Roll Number: 07-01
BSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant futureBSIT07-01 has a brilliant future
Default [Classes] Compre two distance values and display larger One

Code:
#include <iostream>
using namespace std;


class dist
    {
private:
    int feet;
    int inches;
public:
    int publicfeet;
    float publicinches;

    void getdist()
    {

    cout<<"\nEnter Feet : ";
    cin>>feet;
    cout<<"\nEnter Inches  : ";
    cin>>inches;
    
    if(inches>=12)//It will correct the inches...
    {
        feet=feet+inches/12;
        inches=inches%12;
        cout<<"\nNote: The Distance Value is corrected to "<<feet<<"\""<<inches<<"\'\n";

    }
    }


    void largedist(dist a, dist b)
{
    
    if(a.feet>b.feet)
    {feet=a.feet;
        inches=a.inches;
    }
    else if (a.feet<b.feet)
    {    feet=b.feet;
        inches=b.inches;
    }
    else if(a.feet==b.feet)
    {
        if(a.inches>b.inches)
        {feet=a.feet;
        inches=a.inches;}
        else if(a.inches<b.inches)
        {
            feet=b.feet;
        inches=b.inches;
        }
    }
    
    cout<<"\nLarger distace = "<<feet<<"\""<<inches<<"\'";
}    
};

    
void main()
{
    dist a,b,larger;
    a.getdist();
    b.getdist();
    larger.largedist(a,b);    
}

Reply With Quote
Reply

Tags
c++, classes, compre, display, distance, larger, lectures, values


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Schedule for Classes Semester-I Distance Education Salman Mushtaq University News and Events 0 22-04-2012 04:23 PM
Classes Schdule Semester-I Distance Learning Education BZU 2012 Salman Mushtaq University News and Events 0 26-01-2012 02:46 PM
Classes Schdule Distance Learning Education BZU 2012 Salman Mushtaq University News and Events 0 17-01-2012 05:40 PM
The Shortest Distance between a Problem and it’s Solution is the Distance between your Knees and the Floor. The one who Kneel usman_latif_ch Funny Cut Piece 0 14-10-2011 06:44 PM
Getting Random Values in C and C++ with Rand bonfire Introduction to Computing 0 26-02-2011 11:14 PM

Best view in Firefox
Almuslimeen.info | BZU Multan | Dedicated server hosting
Note: All trademarks and copyrights held by respective owners. We will take action against any copyright violation if it is proved to us.

All times are GMT +5. The time now is 09:56 PM.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.