Gosh oh my I dont usually post code just like that for someone's hmk assignment so im only going to post a partial example which does compile and work but it only gives you and idea of what you are looking for... It may not be EXACTLY what you are looking for but it seems like it is of some help... wonder why no one else is posting shudnt be too hard...
#include <iostream>
#include <windows.h>
#include <string.h>
using namespace std;
int main()
{
string url;
cout<<"Please Enter a website: \n";
cin>>url;
if (url.find('.gov') != string::npos)
{
cout<<"website = valid\n";
}
else if (url.find('.edu') != string::npos)
{
cout<<"website = valid\n";
}
else if (url.find('.org') != string::npos)
{
cout<<"website = valid\n";
}
else
cout<<"website = invalid\n";
Sleep(2000);
} Yes i know there are errors and you can figure out what is wrong with it and fix it to suit yourself... It still compiles perfectly though so Enjoy