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

BZU PAGES: Find Presentations, Reports, Student's Assignments and Daily Discussion; Bahauddin Zakariya University Multan (http://bzupages.com/index.php)
-   Object Oriented Programming (http://bzupages.com/forumdisplay.php?f=35)
-   -   Assignment} Exercise#4 Question 9 and 11 (http://bzupages.com/showthread.php?t=684)

.BZU. 04-09-2008 11:06 PM

Assignment} Exercise#4 Question 9 and 11
 
Chapter # 4: Exercise Pages# 159 Question Number 9
Book
Object Oriented Programming by Robert Lafore
Code:

#include
using namespace std;

struct time  // a strcuture time defined
    {
  int hours;  // hours in time
    int minutes;  // minutes in time
    int seconds;  // seconds in time
    };
int main()
{
  int totalsecs;
    time var_time;
    cout<<"Please enter the hours = ";
    cin>>var_time.hours;
    cout<<"Please enter the mintues = ";
    cin>>var_time.minutes;
    cout<<"Please enter the seconds = ";
    cin>>var_time.seconds;
   
    totalsecs = var_time.hours*3600+var_time.minutes*60+var_time.seconds;
    cout<<"total sconds of the given time are calculated as = "< return 0;
}



BSIT07-01 05-09-2008 12:26 AM

Re: Assignment} Exercise#4 Question 9 and 11
 
Solution of Question # 11

Code:

#include
using namespace std;

struct time
{
    int hours,minutes,seconds;

};


int main()


{
    time time1,time2,time3;
  int temp;
  char colon;

    cout<<"enter First time in this format (12:30:30):";
    cin>>time1.hours>>colon>>time1.minutes>>colon>>time1.seconds;

    cout<<"enter Second time in this format (12:30:30):";
    cin>>time2.hours>>colon>>time2.minutes>>colon>>time2.seconds;

    long totalseconds1=time1.hours*3600 + time1.minutes*60 + time1.seconds;

  long totalseconds2=time2.hours*3600 + time2.minutes*60 + time2.seconds;

  long totalseconds=totalseconds1+totalseconds2;

    time3.hours=totalseconds/3600;

    temp=totalseconds%3600;

    time3.minutes=temp/60;

    time3.seconds=temp%60;


    cout<<"\nTotal Time: "<
    return 0;

}


sohail 18-12-2008 01:47 PM

Re: assignemt of cmplexnumbers
 
yar I am student of 3rd semester in bscs kindly help me in my mid term project of oop
the progamme is for complex numbers that perform multipilacation ,division, addition ,substraction i am wating yuor reply i submit my programm at 20 december ok ...............


All times are GMT +5. The time now is 10:13 PM.

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