السلام عليكم
عندي سؤااال بالfunction
انا حليته بس ماطلع الناتج صح ولا عرفت اسوي تكرااار
اتمنى المساااعدة
وهذا السؤاااال
Write a function called hms_to_secs() that takes three int values for hours,minutes,and seconds as arguments, and returns the equivalent time in second(type long). 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.
وهذا حلي
.
.
#include <conio.h>
long hms_to_secs(int h,int m,int s);
int main()
{
int h,m,s;
long total;
cout<<"Enter the time like this format(12:59:59)"<<endl;
cin>>h>>m>>s;
total= hms_to_secs(h,m,s);
cout<<"seconds ="<<total;
getch();
return 0;
}
long hms_to_secs(int h,int m,int s)
{
return (h*3600) +( m*60) + s ;
}
#include <iostream.h>
ومشكوووورين