View Single Post
  #1  
Old 04-09-2008, 11:06 PM
.BZU.'s Avatar
.BZU. .BZU. is offline


 
Join Date: Sep 2007
Location: near Govt College of Science Multan Pakistan
Posts: 9,693
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
Heart Assignment} Exercise#4 Question 9 and 11

Chapter # 4: Exercise Pages# 159 Question Number 9
Book
Object Oriented Programming by Robert Lafore
Code:
#include <iostream>
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 = "<<totalsecs<<endl;
return 0;
}

Here is the result:


__________________
(¯`v´¯)
`*.¸.*`

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

Don't cry because it's over, smile because it happened
Reply With Quote