BZU Multan Student Community


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

Ad

Reply
 
Thread Tools Search this Thread Rating: Thread Rating: 3 votes, 3.67 average. Display Modes
Old 02-09-2008, 04:25 PM   #1
Grown up punk

 
shmsa's Avatar
 
Join Date: Oct 2007


Location: Muslim Town Multan
Posts: 196
Thanks: 20
Thanked 47 Times in 34 Posts
Contact Number: 0322-6196713
Program / Discipline: BSIT
Class Roll Number: 07-22
shmsa is a jewel in the roughshmsa is a jewel in the roughshmsa is a jewel in the roughshmsa is a jewel in the rough
Time Spent Online: 2 Days 16 Hours 43 Minutes 59 Seconds
lectures Find the AREA of a Home By using Nested Struct C++

THE AREA is in ASSignment


#include <iostream> using namespace std; struct dist { int feet; int inches; }; struct room { dist length; dist width; }r1,r2,r3,tot,totareaf,totareai; int main() { r1.length.feet=5; r1.length.inches=3; r1.width.feet=5; r1.width.inches=3; r2.length.feet=5; r2.length.inches=3; r2.width.feet=5; r2.width.inches=3; r3.length.feet=5; r3.length.inches=3; r3.width.feet=5; r3.width.inches=3; tot.length.feet=r1.length.feet+r2.length.feet+r3.length.feet; tot.length.inches=r1.length.inches+r2.length.inches+r3.length.inches; tot.width.feet=r1.width.feet+r2.width.feet+r3.width.feet; tot.width.inches=r1.width.inches+r2.width.inches+r3.width.inches; if(tot.length.inches>=12) { tot.length.feet+=tot.length.inches/12; tot.length.inches=tot.length.inches % 12; } if(tot.width.inches>=12) { tot.width.feet+=tot.width.inches/12; tot.width.inches=tot.width.inches % 12; } cout<<"total length "<<tot.length.feet<<"'"<<tot.length.inches<<"\""<<endl; cout<<"total width "<<tot.width.feet<<"'"<<tot.width.inches<<"\""<<endl; totareaf.length.feet=tot.length.feet*tot.width.feet; totareai.length.inches=tot.length.inches*tot.width.inches; if(totareai.length.inches>=12) { totareaf.length.feet+=totareai.length.inches/12; totareai.length.inches=totareai.length.inches% 12; } cout<<"The Total Area of the house is "<<totareaf.length.feet<<"'"<<totareai.length.inches<<"\""<<endl; return 0; }

Advertisement
Views: 289

Last edited by BSIT07-01; 03-09-2008 at 02:47 AM. Reason: quoted in CODE
shmsa is offline  
Reply With Quote
The Following 2 Users Say Thank You to shmsa For This Useful Post:
.BZU. (02-09-2008), BSIT07-01 (02-09-2008)
Top 10 Lists

Old 03-09-2008, 02:34 AM   #2
Addicted to Computer


 
BSIT07-01's Avatar
 
Join Date: Sep 2007


Location: ------------
Age: 22
Posts: 1,339
Thanks: 597
Thanked 357 Times in 288 Posts
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
Time Spent Online: 1 Month 3 Days 9 Hours 5 Minutes 10 Seconds
Default Re: Find the AREA of a Home By using Nested Struct C++

Yeh bhi Hay...
Check it.

#include <iostream> using namespace std; struct dist { int feet; int inches; }; struct room { dist width; dist length; }; room r1,r2,r3,rsum; int areafeet; int areainches; int main() { r1.width.feet=5; r1.width.inches=25; r1.length.feet=5; r1.length.inches=45; r2.width.feet=5; r2.width.inches=65; r2.length.feet=5; r2.length.inches=75; r3.width.feet=5; r3.width.inches=65; r3.length.feet=5; r3.length.inches=75; rsum.width.feet=r1.width.feet+r2.width.feet+r3.width.feet; rsum.width.inches=r1.width.inches+r2.width.inches+r3.width.inches; rsum.length.feet=r1.length.feet+r2.length.feet+r3.length.feet; rsum.length.inches=r1.length.inches+r2.length.inches+r3.length.inches; if(rsum.length.inches>=12) { rsum.length.feet+=rsum.length.inches/12; rsum.length.inches=rsum.length.inches%12; } if(rsum.width.inches>=12) { rsum.width.feet+=rsum.length.inches/12; rsum.width.inches=rsum.length.inches%12; } cout<<"Total Length = "<<rsum.length.feet<<"'"<<rsum.length.inches<<"\""<<endl; cout<<"Total Width = "<<rsum.width.feet<<"'"<<rsum.width.inches<<"\""<<endl; areafeet=rsum.length.feet*rsum.width.feet; areainches=rsum.length.inches*rsum.width.inches; if(areainches>=12) { areainches=areainches%12; areafeet+=areafeet/12; } cout<<endl<<"Total area = "<<areafeet<<"'"<<areainches<<"\""<<endl; return 0; }

BSIT07-01 is offline   Reply With Quote
The Following User Says Thank You to BSIT07-01 For This Useful Post:
.BZU. (03-09-2008)
Old 03-09-2008, 02:39 AM   #3
Your Friendly Admin
Innocent Baby
BSIT Professional


 
.BZU.'s Avatar
 
Join Date: Sep 2007


Location: near Govt College of Science Multan Pakistan
Posts: 9,487
Thanks: 2,310
Thanked 2,182 Times in 1,782 Posts
Contact Number: Removed
Program / Discipline: BSIT
Class Roll Number: 07-15
.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute
Time Spent Online: 3 Months 3 Weeks 3 Days 10 Hours 48 Minutes 53 Seconds
Default Re: Find the AREA of a Home By using Nested Struct C++

Here is the Result...,
Name:  here is result.JPG
Views: 24
Size:  10.4 KB
__________________
(¯`v´¯)
`*.¸.*`

¸.*´¸.*´¨) ¸.*´¨)
(¸.*´ (¸.
Bzu Forum

Don't cry because it's over, smile because it happened
.BZU. is offline   Reply With Quote
Old 06-09-2008, 01:15 AM   #4
Your Friendly Admin
Innocent Baby
BSIT Professional


 
.BZU.'s Avatar
 
Join Date: Sep 2007


Location: near Govt College of Science Multan Pakistan
Posts: 9,487
Thanks: 2,310
Thanked 2,182 Times in 1,782 Posts
Contact Number: Removed
Program / Discipline: BSIT
Class Roll Number: 07-15
.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute.BZU. has a reputation beyond repute
Time Spent Online: 3 Months 3 Weeks 3 Days 10 Hours 48 Minutes 53 Seconds
Default Re: Find the AREA of a Home By using Nested Struct C++

Madam nay dono ka wrong kar diya hay...
hahahha..... Actualy area yeh nahi aa ay ga jo kay hum nay likha hay...
__________________
(¯`v´¯)
`*.¸.*`

¸.*´¸.*´¨) ¸.*´¨)
(¸.*´ (¸.
Bzu Forum

Don't cry because it's over, smile because it happened
.BZU. is offline   Reply With Quote
Old 06-09-2008, 05:41 AM   #5
Addicted to Computer


 
BSIT07-01's Avatar
 
Join Date: Sep 2007


Location: ------------
Age: 22
Posts: 1,339
Thanks: 597
Thanked 357 Times in 288 Posts
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
Time Spent Online: 1 Month 3 Days 9 Hours 5 Minutes 10 Seconds
Default Re: Find the AREA of a Home By using Nested Struct C++

hmmm; Koi baat nahi...
Ghalat ho gaya hay tu hi sahi hoga na ! Aise thori sahi ho jaye ga..
BTW I've tried to correct it, lakin nahi hua mere se tu..
BSIT07-01 is offline   Reply With Quote
Reply

Tags
area, assignment, c++, find, home, nested, struct


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
Calculate Area Of Rectangle In c# thecool Visual Programming 0 17-06-2011 09:54 PM
Program to find the sum of each row & column of a matrix of size n x m and if matrix is square, find the sum of the diagonals bonfire Object Oriented Programming 0 09-03-2011 12:01 AM
How to Park Car in a No Parking Area.... Raheel Funny Audio & Video Clips 0 10-06-2010 04:57 PM
Running Home finally I can own a home for my self...... usman_latif_ch BZU Graphics and Wallpapers 0 08-05-2009 04:40 PM
Table of 5-10 Using Nested Loops BSIT07-01 Computer programming for IT 6 25-04-2008 08:21 AM

Best view in Firefox
Free File Hosting | Webmaster Forum | Cloud Computing | Dedicated server hosting
Note: This is an unofficial Site...
All trademarks and copyrights held by respective owners. We will take action against any copyright violation if it is proved to us.



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.