#include<iostream> using namespace std; #include<string> void fun1(string str, int n) { for(int i=0; i<n; i++) cout<<str<<endl; } void fun2() { fun1("Three blind mice",2); fun1("See how they run",2); } int main() { fun2(); }
#include<iostream> using namespace std; #include<string> void fun(int hour, int minute) {
if(hour>=0&&hour<24&&minute>0&&minute<10)
cout<<"Time "<<hour<<":0"<<minute<<endl;
else if(hour>=0&&hour<24&& minute>100&&minute<60)
cout<<"Time "<<hour<<":"<<minute<<endl;
else cout<<"Error"<<endl;
} int main() { int h,m; cout<<"Enter the number of hours:"; cin>>h; cout<<"Enter the number of minutes:"; cin>>m; fun(h,m); }