| | |
Urgent help #2
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Oct 2009
Posts: 22
Reputation:
Solved Threads: 0
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!
______
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!
•
•
Join Date: Oct 2009
Posts: 27
Reputation:
Solved Threads: 2
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...
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
C++ Syntax (Toggle Plain Text)
#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
•
•
Join Date: Oct 2009
Posts: 9
Reputation:
Solved Threads: 1
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;
}
#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;
}
•
•
Join Date: Jan 2008
Posts: 3,832
Reputation:
Solved Threads: 501
3
#5 Oct 10th, 2009
- 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.
![]() |
Similar Threads
- pls heeeeeeeeelp its urgent. (C)
- Urgent! (C++)
- URGENT: Need help on I/O code! (Java)
- Urgent help (Networking Hardware Configuration)
- Homepage keeps switching back to a porn site (Web Browsers)
- Importing SQL Script File - Urgent !! (Database Design)
Other Threads in the C++ Forum
- Previous Thread: C++ maskedtextbox (IP address)
- Next Thread: <Non-trivial> overloading operator []
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays assignment beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete developer dll dynamiccharacterarray email encryption error file format forms fstream function functions game generator getline graph homeworkhelper iamthwee ifstream image input int integer java lib list loop looping loops map math matrix memory multidimensional multiple newbie news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings struct template text tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






