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!

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

#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;
}

Edited 3 Years Ago by Dani: Formatting fixed

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. :)

Comments
Well said.
Thank you :)

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!

This question has already been answered. Start a new discussion instead.