954,498 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Urgent help #2

Please, I'm not sure about this exercise, if someone can help me, thanks! I know it's something about .find() or .size(). and return the variable. Here is the exercise:
______

Write the code that prompts the user to enter a home web page address of the website that is used for research paper and store it into variable url. Declare variable extension and initialize it with the domain extension of the website. Your program then should output if the web site is a reliable source. Websites with extension org, gov, and edu are considered reliable. example: if web address contains the value of "www.mdc.edu", then extension should contain "edu", and your output should be "Yes, www.mdc.edu contains extension edu and is thus reliable."

THANK YOU, IF ANY HELP!

sebassn
Newbie Poster
22 posts since Oct 2009
Reputation Points: 9
Solved Threads: 0
 

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

triumphost
Posting Whiz
390 posts since Oct 2009
Reputation Points: 57
Solved Threads: 36
 

#include
#include
#include


#include

using namespace std;

int main()
{
int a,d,q,r;
cout<<"Numerator: \n";
cin>> a; //a is divident (numerator)
cout<<"Denominator: \n";
cin>> d;

// d is divisor (denominator)
q=((a) / (d)); //q is quotient (plain old value without remainder)

r= (a-(q*d)); //r is remainder

cout<< a <<" / "<< d <<" = "<< q <

ayeshawzd
Newbie Poster
10 posts since Oct 2009
Reputation Points: 10
Solved Threads: 1
 

now u can try n no thanks needs

ayeshawzd
Newbie Poster
10 posts since Oct 2009
Reputation Points: 10
Solved Threads: 1
 
now u can try n no thanks needs
  • Post has nothing to do with the thread.
  • Original poster has shown no effort, so you shouldn't be fixing the code from another poster, even if you were posting on the correct thread, which, again, you are not.
  • No code tags.
  • Leet speak is really annoying on these forums.
  • It's presumptuous to say that no thanks are needed before any have been offered. We'll thank you or not thank you as we damn well please, whether you want us to or not. ;)

Read the rules. 1 through 4 above are actually in the rules. I just threw 5 in there because I thought it needed to be said. If anyone wants to thank me for this post, you have my permission. :)

VernonDozier
Posting Expert
5,527 posts since Jan 2008
Reputation Points: 2,633
Solved Threads: 711
 

wow he posted my code corrected as his own... oh my and on the wrong post...

triumphost
Posting Whiz
390 posts since Oct 2009
Reputation Points: 57
Solved Threads: 36
 

Hey Vernon you are right. Thank you.
I just did this without thinking well because I was kind of desperate and in need for those...I am truly sorry. I know now what is the real meaning of these forums. I'll show effort next time I need help from you guys. Thank you again!

sebassn
Newbie Poster
22 posts since Oct 2009
Reputation Points: 9
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You