Urgent help #2

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Oct 2009
Posts: 22
Reputation: sebassn is an unknown quantity at this point 
Solved Threads: 0
sebassn sebassn is offline Offline
Newbie Poster

Urgent help #2

 
-1
  #1
Oct 9th, 2009
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!
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 27
Reputation: triumphost is an unknown quantity at this point 
Solved Threads: 2
triumphost triumphost is offline Offline
Light Poster
 
0
  #2
Oct 9th, 2009
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...

  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
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 9
Reputation: ayeshawzd is an unknown quantity at this point 
Solved Threads: 1
ayeshawzd ayeshawzd is offline Offline
Newbie Poster
 
0
  #3
Oct 10th, 2009
#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;
}
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 9
Reputation: ayeshawzd is an unknown quantity at this point 
Solved Threads: 1
ayeshawzd ayeshawzd is offline Offline
Newbie Poster
 
-2
  #4
Oct 10th, 2009
now u can try n no thanks needs
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 3,832
Reputation: VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute 
Solved Threads: 501
Featured Poster
VernonDozier VernonDozier is offline Offline
Senior Poster
 
3
  #5
Oct 10th, 2009
Originally Posted by ayeshawzd View Post
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.
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 27
Reputation: triumphost is an unknown quantity at this point 
Solved Threads: 2
triumphost triumphost is offline Offline
Light Poster
 
0
  #6
Oct 10th, 2009
wow he posted my code corrected as his own... oh my and on the wrong post...
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 22
Reputation: sebassn is an unknown quantity at this point 
Solved Threads: 0
sebassn sebassn is offline Offline
Newbie Poster
 
3
  #7
Oct 10th, 2009
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!
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



Tag cloud for C++
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC