Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

2. Write a function called hms_to_secs() that takes
three int values&#8212;for hours, minutes, and seconds&#8212;as
arguments, and returns the equivalent time in seconds..
Create a program that exercises this function by repeatedly
obtaining a time value in hours, minutes, and seconds from
the user (format 12:59:59), calling the function, and
displaying the value of seconds it returns.

Answer Posted / htoo cherry

#include <iostream >
Using namespace std ;
long hms_to_secs (int, int, int) ;
int main ()
{int hrs, min, sec;
cout <<"Enter hours" <<endl ;cin>>hrs;
cout <<"Enter minutes " <<endl ;cin>>min;
cout <<"Enter seconds" <<endl ;cin <<sec;
cout <<hrs<<":" <<min<<":" <<sec<<":" <<endl ;
cout <<The time in seconds<<hms_to_secs (int hrs, int min, int sec) ;
}
long hms_to_secs (int h, int m, int s)
return( h*3600+m*60+s);

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a spanning Tree?

1501


Write a program to input the price of 1 burger and the number of burgers eaten by a group of friends .print the total amount to be paid by the group?

984


Explain what are the different data types in c?

1159


What is void c?

1012


Is there any algorithm to search a string in link list in the minimum time?(please do not suggest the usual method of traversing the link list)

2245


any C program contains only one function, it must be a) void () b) main () c) message () d) abc ()

1074


Why functions are used in c?

1070


a=10;b= 5;c=3;d=3; if(a printf(%d %d %d %d a,b,c,d) else printf("%d %d %d %d a,b,c,d);

1067


What is the difference between text and binary i/o?

997


Can include files be nested?

1058


What is f'n in math?

1009


What is gets() function?

1073


Explain how can I right-justify a string?

991


difference between object file and executable file

6640


program to find error in linklist.(i.e find whether any node point wrongly to previous nodes instead of next node)

2044