#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
void openLink(const string& Link);
int main()
{
int num ;
cout<<"please enter a nubmer: "<<endl;
cin>>num;
while(num!=1 && num!=4)
{
int sum=0;
int temp =num;
while(temp>0)
{
int digit = temp%10;
sum += digit*digit;
temp /= 10;
}
num = sum;
}
if(num == 1)
{
cout<<"the number is happy"<<endl;
string youtubeLink = "https://www.youtube.com/watch?v=dQw4w9WgXcQ";
openLink(youtubeLink);
}
else
{
cout<<"the number is sad"<<endl;
}
return 0 ;
}
void openLink(const string& link)
{
#ifdef _WIN32
system((std::string("start ") + link).c_str());
#elif defined(linux)
system((std::string("xdg-open ") + link).c_str());
#elif defined(APPLE)
system((std::string("open ") + link).c_str());
#endif
}
#code
@mathloopinfinite