944,134 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 665
  • C++ RSS
Oct 9th, 2009
-1

Urgent help #2

Expand Post »
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!
Similar Threads
Reputation Points: 9
Solved Threads: 0
Newbie Poster
sebassn is offline Offline
22 posts
since Oct 2009
Oct 9th, 2009
0
Re: Urgent help #2
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...

C++ Syntax (Toggle Plain Text)
  1. #include <iostream>
  2. #include <windows.h>
  3. #include <string.h>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. string url;
  10. cout<<"Please Enter a website: \n";
  11. cin>>url;
  12.  
  13. if (url.find('.gov') != string::npos)
  14. {
  15. cout<<"website = valid\n";
  16. }
  17. else if (url.find('.edu') != string::npos)
  18. {
  19. cout<<"website = valid\n";
  20. }
  21. else if (url.find('.org') != string::npos)
  22. {
  23. cout<<"website = valid\n";
  24. }
  25. else
  26.  
  27. cout<<"website = invalid\n";
  28.  
  29. Sleep(2000);
  30. }


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
Reputation Points: 55
Solved Threads: 20
Posting Whiz in Training
triumphost is offline Offline
262 posts
since Oct 2009
Oct 10th, 2009
0
Re: Urgent help #2
#include <iostream>
#include <windows.h>
#include <math.h>


#include <cmath>

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 <<endl<<" with remainder "<< r <<endl;

system("pause");
return 0;
}
Reputation Points: 10
Solved Threads: 1
Newbie Poster
ayeshawzd is offline Offline
10 posts
since Oct 2009
Oct 10th, 2009
-2
Re: Urgent help #2
now u can try n no thanks needs
Reputation Points: 10
Solved Threads: 1
Newbie Poster
ayeshawzd is offline Offline
10 posts
since Oct 2009
Oct 10th, 2009
3
Re: Urgent help #2
Click to Expand / Collapse  Quote originally posted by ayeshawzd ...
now u can try n no thanks needs
  1. Post has nothing to do with the thread.
  2. 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.
  3. No code tags.
  4. Leet speak is really annoying on these forums.
  5. 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.
Featured Poster
Reputation Points: 2614
Solved Threads: 687
Posting Expert
VernonDozier is offline Offline
5,375 posts
since Jan 2008
Oct 10th, 2009
0
Re: Urgent help #2
wow he posted my code corrected as his own... oh my and on the wrong post...
Reputation Points: 55
Solved Threads: 20
Posting Whiz in Training
triumphost is offline Offline
262 posts
since Oct 2009
Oct 10th, 2009
3
Re: Urgent help #2
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!
Reputation Points: 9
Solved Threads: 0
Newbie Poster
sebassn is offline Offline
22 posts
since Oct 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: C++ maskedtextbox (IP address)
Next Thread in C++ Forum Timeline: <Non-trivial> overloading operator []





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC