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

Register FAQ Community Calendar New Posts Navbar Right Corner
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 10-09-2008, 11:12 PM
taha khan's Avatar
Toddler

 
Join Date: Oct 2007
Location: Mumtaaz Abad Multan
Age: 34
Posts: 22
Class Roll Number: 07-06
taha khan will become famous soon enough
Send a message via Yahoo to taha khan
Default solve the ambiguity in my prog.

Code:
#include<iostream>
using namespace std;
int x,y,a,z;
float length,width,area;
struct dist
{
 int feet;
 float inches;
};
struct room
{dist length;
dist width;
}r1,r2,r3,sum;
int main()
{
  r1.length.feet=5;
  r2.length.feet=10;
  r3.length.feet=15;
  r1.length.inches=2;
  r2.length.inches=5;
  r3.length.inches=7;
  r1.width.feet=5;
  r2.width.feet=10;
  r3.width.feet=15;
  r1.width.inches=2;
  r2.width.inches=3;
  r3.width.inches=7;
  sum.length.feet=r1.length.feet+r2.length.feet+r3.length.feet;
  sum.length.inches=r1.length.inches+r2.length.inches+r3.length.inches;
  sum.width.feet=r1.width.feet+r2.width.feet+r3.width.feet;
  sum.width.inches=r1.width.inches+r2.width.inches+r3.width.inches;
  if(sum.length.inches>=12)
  {sum.length.inches=x;
  sum.length.inches=x%12;  
  sum.length.feet+=x/12;
  
  }
  cout<<"length="<<sum.length.feet<<"feet"<<"and"<<sum.length.inches<<"inches"<<endl;
   if(sum.width.inches>=12)
  {sum.width.inches=a;
  sum.width.feet+=(a/12);
  sum.width.inches=(a%12);
   }
  cout<<"width="<<sum.width.feet<<"feet and"<<sum.width.inches<<"inches"<<endl;
  length=sum.length.feet+sum.length.inches;
  width=sum.width.feet+sum.width.inches;
  area=length*width;
  
  cout<<"area ="<<area;
  
  
  ; return 0;
 }

Reply With Quote
  #2  
Old 10-09-2008, 11:28 PM
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 Re: solve the ambiguity in my prog.

In if Statement

if(sum.width.inches>=12)
{sum.width.inches=a;
sum.width.feet+=(a/12);
sum.width.inches=(a%12);
}

change sum.width.inches=a; to a=sum.width.inches;
Reply With Quote
Reply

Tags
ambiguity, c++, lectures, prog, solve


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

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
If u can solve your problem, then what's .BZU. Quotes 2 04-09-2011 11:16 AM
Can you solve this ? Raheel Funny Cut Piece 3 15-12-2010 08:50 PM
Solve The Mystery Raheel Funny Cut Piece 4 22-11-2010 08:28 PM
how i solve da cube shahidkhan Funniest Pictures 0 01-01-2010 02:18 PM
Problem Solve mani BBA (Hons.) 4 07-07-2009 11:39 AM

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 11:10 AM.
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.