- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 2
- Posts with Upvotes
- 2
- Upvoting Members
- 1
- Downvotes Received
- 3
- Posts with Downvotes
- 2
- Downvoting Members
- 2
15 Posted Topics
Here you go. Let me know if you find any problems - I wrote this while half asleep. [CODE] #include <iostream> #include <vector> using namespace std; bool isDelim(const char& query, const string& delimList){ for(int i = 0; i < delimList.length(); i++) if(query == delimList[i]) return true; return false; } vector<string> …
Or in a more compact way: [CODE] const string PLANETS[10] = {"mercury", "venus", "earth", "moon", "mars", "jupiter", "saturn", "uranus", "neptune", "pluto"}; const double GRAVITY[10] = {0.4155, 0.8975, 1.0, 0.166, 0.3507, 2.5374, 1.0677, 0.8947, 1.1794, 0.0899}; string strLower(string s) { for(int i = 0; i < s.length(); i++) s[i] = tolower(s[i]); …
This little program will launch your g++ compiler and time how long it took to compile the source. Update the compiler_path variable to reflect your system's configuration. [CODE]#include <iostream> #include <ctime> #include <string> using namespace std; int main(){ string compiler_path = "c:\\mingw\\bin\\g++.exe"; cout << "Enter the file to compile: "; …
Post what you have done so far to show you've made some effort. Nobody is going to do your assignments for you.
In the headers folder, right-click and create a new .h file. This is where your class declarations go. In the sources folder, create a new .cpp file to add your implementation of the class. Here's an example: [URL="http://www.learncpp.com/cpp-tutorial/89-class-code-and-header-files/"]http://www.learncpp.com/cpp-tutorial/89-class-code-and-header-files/[/URL]
[CODE] No need to create extra pointers - just dereference and increment. double average (double* a, int a_size){ double total = 0.0; for (int i = 0; i < a_size; i++) total += *a++; return total / a_size; } [/CODE]
Don't get discouraged, most people feel the same way when encountering subnetting for the first time - it is probably the most difficult networking subject. Have a look at these: [URL="http://learn-networking.com/network-design/how-to-subnet-a-network"]learn-networking.com - how to subnet a network[/URL] [URL="http://www.cisco.com/en/US/tech/tk365/technologies_tech_note09186a00800a67f5.shtml"]cisco.com - IP Addressing and Subnetting for New Users[/URL] [URL="http://www.subnetmask.info/"]subnetmask.info - Networking Calcuclators[/URL] …
Here's an example based on your request: [CODE]#include <iostream> int main(){ double numInput; while(true){ std::cout << "Enter a Number (Max 10 digits)(99 to Exit): "; std::cin >> numInput; if( numInput - static_cast<int>(numInput) != 0.0 ) std::cout << "Invalid Try Again" << std::endl; else break; } if( numInput == 99.0 ) …
[CODE]#include <iostream> #include <fstream> #include <vector> #include <string> using namespace std; template <class T> void swap(T* a, T* b){ T temp = a; a = b; b = temp; } int main() { ifstream infile; vector<double> vecGPA; vector<string> vecNames; double gpa; string name; // load data from file infile.open("gpa.txt"); while(infile …
I've made a list for some of the more common torrent sites which you can append to your hosts file to "re-route" those connections. Open the hosts file (c:\windows\system32\drivers\etc\hosts) with a text editor and append the following list: [CODE] # torrent block list 127.0.0.1 www.isohunt.com 127.0.0.1 isohunt.com 127.0.0.1 www.thepiratebay.com 127.0.0.1 …
Have a look at these: [URL="http://en.wikipedia.org/wiki/C%2B%2B_Standard_Library"]http://en.wikipedia.org/wiki/C%2B%2B_Standard_Library[/URL] [URL="http://www.cplusplus.com/reference/"]http://www.cplusplus.com/reference/[/URL] If you're going to be a good programmer, start reading...a lot!
Stacks are available in the STL as container adapters. You can use a vector-based stack with the STL such as: [CODE]#include <stack>[/CODE] [CODE]stack<int, vector<int>> myStack;[/CODE] More details and a list of member functions can be found here: [URL="http://www.cplusplus.com/reference/stl/stack/"]http://www.cplusplus.com/reference/stl/stack/[/URL]
You could also add a registry key to allow compiling by simply right-clicking on a .cpp file and selecting 'Compile This' (or whatever you want to call it). To do this, open your registry editor Start > Run > type [I]regedit [/I](enter). Expand the folders HKEY_CLASSES_ROOT > * > shell. …
[CODE]std::cout << "3x" << char(253);[/CODE]
I have [I]C++ Primer Plus[/I] by Prata (5th ed) and it is an excellent book as it assumes no prior programming experience and will serve as a good reference later on. It's size may be intimidating but if you really want to be a good programmer with C++, it is …
The End.
user422