2,898 Posted Topics
Re: You are missing the curly braces in this for loop: for(int j=0; j<=years; j++) cout<<"Enter runs scored by player"<<":"<<i+1<<": "; cin>>record[i][j]; You'll see it better if you space it out and indent properly: for(int j = 0; j <= years; j++) cout << "Enter runs scored by player" << ":" … | |
Re: In RPM-based systems (Fedora, Red Hat, etc.), you generally use the `yum` command: $ sudo yum install package_name (where `package_name` is the name of whatever package you want to install, not the file name, just the name) In Debian-based systems (Ubuntu, Debian, etc.), you generally use the `apt-get` command: $ … | |
Re: This all depends on how you want to install it. One option is to use a virtual machine, like VirtualBox. This will create one big file (that you place wherever you like) that is a kind of disk image. Basically, with this option, you can install Ubuntu (or any other … | |
Re: I don't see anything wrong with this code. My guess is that it is not a problem with either the printing or the iterators "resetting". It's most likely a problem with the creation of those vectors. In other words, what is being printed is exactly what is in those vectors. … | |
Re: This is called a [Singleton](http://en.wikipedia.org/wiki/Singleton_pattern) class. The most straight-forward way to implement it in C++ is as follows: // in the header file: class MySingleton { private: // private constructor: MySingleton() { }; // private copy-constructor (left undefined): MySingleton(const MySingleton&); // private copy-assignment operator (left undefined): MySingleton& operator=(const MySingleton&); public: … | |
Re: > If you truly index by area then you have an array such that &array[area] is valid I think your definition of "indexing" is bit off of the conventional definition of the term. For one, the OP states "a search index", which is very explicit. But even without that precision, … | |
Re: The trick to turn a single numeric character (digit) into an integer value is to simply subtract the value of the character `'0'` because it is almost certain (in all reasonable character sets) that digit characters have values that are sequential (e.g., in the ASCII table, the characters 0, 1, … | |
Re: I think they serve very different purposes. I think that it is true that a lot of the wide-distribution applications for "light" work or for play are shifting towards web applications more and more. But that's because there are more and more people using the internet (duh!) and more companies … | |
Re: The type `char arrayOnes[10];` is an array of 10 characters. In your initializer, you are defining an array of strings (which are themselves arrays of characters). This would be the correct version: const char* arrayOnes[10] = {"", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"}; The above defines an … | |
Re: This is by design. If you read the first thread on a forum, all the other threads are marked as read. I don't like this behavior either, but it is intentionally so (don't ask me why). | |
Re: Do you really need a class? Computing the FFT seems more appropriate as a kind of function than a kind of class. And you can make the choice of input / output containers external to that function by using the established C++ practice of using generic iterators. For example, you … | |
Re: There might be a stray character on the input stream. Try to use `cin.ignore();` before the second input. | |
Re: As simple as this: #include <iostream> // to print to console #include <fstream> // to read / write to a file #include <string> // to represent words (strings) int main() { std::ofstream output_file; output_file.open("test.txt"); // open a file for outputting to it. std::string data = "Hello World!"; // create some … | |
Re: > should i start learning about hardware or software? You take on a project and you learn what you have to. In robotics, it's pretty much inevitable to have to have a well-rounded set of skills. Each piece of hardware (sensors, motors, servos, controllers, batteries, etc.) have their quirks, which … | |
Re: The library you are looking for is [OpenCV](http://opencv.willowgarage.com/wiki/) (Open Computer Vision Library). It is used extensively in artificial intelligence / robotics applications for image processing tasks. | |
Re: It makes no difference whatsoever when it comes to global symbols. I tried the following source file: #include "header.h" #if 0 using company::module::ProjectConstants; const int ProjectConstants::CONSTANT1 = 10; const std::string ProjectConstants::CONSTANT2("Hello World"); #else namespace company { namespace module { const int ProjectConstants::CONSTANT1 = 10; const std::string ProjectConstants::CONSTANT2("Hello World"); }; }; … | |
Re: Of course you don't have to ask for permission to give your opinion on something, whether on a public website or anywhere else. That's an essential part of the "free" in "free speech". You can speak about anything to anyone, express any opinion you want, and you can offend people … | |
Re: Any Linux distro is good for C++. The C / C++ languages are fundamental to Linux and GNU tools, not so much in Mac (C / Objective-C are the preferred language, and C++ is pretty terrible to use on Macs). Qt is also a great choice for Linux (and all … | |
Re: First, you need to use standard headers and only standard headers. The headers like `iostream.h` are pre-standard (before 1998), and should no longer be used, more the `.h` part (note: this is for standard headers only). The C-standard headers like `math.h` and `stdlib.h` must have the `.h` removed and a … | |
Re: There isn't much point in delving into ICs unless you plan to mass produce. They are just electronic circuits made to be much smaller, far less energy-hungry and much cheaper to produce. If your interest is semi-conductor physics than that's one thing, but if your interest is electronics, do electronics, … | |
Re: Well, the most complete source for information on the pre-processor is the section on it in the [C++ standard document](http://isocpp.org/std/the-standard) (you can download the draft for free, almost identical to the actual thing). The section only has 11 pages (which is extremely short of a chapter of the standard). The … | |
Re: you shouldn't use the `${}` evaluation for the variable in the for loop, at least, I never do. And the for loop will recognize the globbing too, so you shouldn't use the `ls` command. Try this: for i in ~/Pictures/Screenshot\ from*.png; do mv ${i} /home/garrett/Pictures/ScreenShots/ done | |
Re: Many compilers have an "extension" to allow for zero-size arrays, I don't understand why, but they do. According to standard, this code should not compile. And those compilers that implement this zero-size array extension, end up producing a class with size of 0, as a quirk. In my opinion, this … | |
Re: This is a case of [return-value-optimization](http://en.wikipedia.org/wiki/Return_value_optimization) (or RVO). This is one of the few cases (with copy elision) where the compiler is allowed to change the behavior of the code (by eliminating calls to copy constructors and destructors) for optimization purposes. In other words, never depend on a specific number … | |
Re: It seems a bit too convoluted. There is a standard (now) method for doing this. See [this example](http://www.boost.org/doc/libs/1_53_0/libs/bind/bind.html#with_boost_function) using Boost.Bind and Boost.Function. Both of these libraries are now part of the standard (C++11) in the [`<functional>` header](http://en.cppreference.com/w/cpp/utility/functional). You can basically implement your example like this: #include <iostream> #include <functional> #include … | |
Re: I haven't explored Chrome extensions all that much, but here are a few that I use and like: [Grammarly Lite](https://chrome.google.com/webstore/detail/grammarly-lite-smart-spel/kbfnbcaeplbcioakkpcpgfkobkghlhen) - "Smart" spellchecker. [Session Buddy](https://chrome.google.com/webstore/detail/session-buddy/edacconmaakjimmfgnblocblbcdcpbko) - This is an extension to manage sessions (a collection of open tabs). It is nice because if you have to close all browsers or … | |
Re: > what is the use of :: in them ?? A simple trick, just think of `Foo::Bar` as meaning "Bar from Foo". This meaning works everywhere you see those `::`. Like `std::cout` is "cout from std namespace". Or `MyClass::SomeFunction()` means "call SomeFunction() from MyClass". In fancy C++ terminology, the `::` … ![]() | |
Re: What consumes most RAM (besides the browser) is the desktop environment as a whole. Ubuntu's latest versions that have Unity and all the latest bells and whistles that come with it is on the heavier side when it comes to Linux desktop environments. This definitely does not sound like something … ![]() | |
Re: The database part is almost definitely better handled with a database engine. A reasonably good and cross-platform, and free one is [MySQL](https://en.wikipedia.org/wiki/MySQL). All database engines are setup in a server-client arrangement over a network (or loopback). And most GUI toolkits (I recommend Qt) have a number of pre-existing widgets to … ![]() | |
Re: What makes you think that there is supposed to be a sequence of characters at the end of a file that indicate that the file has reached the end? The EOF flag is artificial, it doesn't appear in the files. If you try to read / write to a file … | |
Re: I have to agree with jwenting (that's a first!), cloud-based services of the likes of Google Docs are pretty much the biggest hole in internet security right now, and everyone is pushing to make it bigger. If you use them, limit your use to uploading files into a public dropbox … | |
Re: First of all, if you don't need the AbstractClass beyond the scope of the constructor, then all you need to do is make the constructor templated: class FileWriter { ofstream file; public: template <class AbstractClass> FileWriter(const string& fileName, const AbstractClass& ab) { // must turn on io-exceptions, as the only … | |
Re: > The 1980s weren't that great. Except for the invention of the Internet, the adoption of seatbelts, Michael Jackson, Knight Rider, and, of course, the invention of miniskirts. And the greatest miracle of them all, my birth ;) > Can it be possible to give the header file windows.h in … | |
Re: You're correct. The standard sort function will provide const objects to the comparison function. When calling a function with a const object as parameter, the function must take the object either by const-reference or by value. This is why changing the signature of the comparion function to non-const references does … | |
Re: Simulation is a far too general term. What kind of simulation? What kind of system do you want to simulate? If you're talking about a dynamic system (i.e., differential equation of motion), then at the base all you need is some good numerical integrators library, then probably some linear algebra … | |
Re: For simple image manipulations like that, I find that the [FreeImage library](http://freeimage.sourceforge.net/) is pretty nice and easy. And it works well in Windows too. | |
Re: For one, you cannot overload operators for basic types like `int` or `double` or whatever, there must be at least one non-primitive type in the operator's signature. In this case, it is OK on that aspect because `ostream& os` is a non-primitive type. However, there already exists an `operator<<` for … | |
Re: I just tried it out. I have Kubuntu 12.10, with python installed (default) and with the mxDateTime and Mako installed as instructed by JasonHippy. I extracted the Haizea sources as instructed, I launched the setup.py as instructed, and received a message similar to yours (ending in "Writing ... haizea-1.0.egg-info"). All … | |
Re: I don't know about file sizes specifically, but have you tried [Qt](http://qt.digia.com/)? It fits all your other criteria: easy to use, good RAD tool, and LGPL (or commercial) licensing. As for tnFox, I have never heard of it. | |
Re: According to the problem statement and according to the function declaration, what you should do is take the three numbers as input (cin) before calling the function, and then pass those three numbers to the function to get the result. As so: #include <iostream> #include <cmath> // <-- notice, the … | |
Re: > The solution is simple your programs won't work on anything but turbo c so your only choice is to carry on using it. Well, another solution is to make all the necessary changes to the code so that it works on a modern compiler. If the project is not … | |
Re: Start by reading some reviews and picking a distribution that might be a good fit for you. For example, these [latest reviews](http://www.pcpro.co.uk/features/382288/best-linux-distros-for-2013), or [these](http://www.linux.com/news/software/applications/708977-the-2013-top-7-best-linux-distributions-for-you), or [these](http://www.linuxcircle.com/2013/03/28/top-10-linux-distros-for-desktop/). Also, you should know that often what matters most to a casual user is the eye-candy, i.e., the look and feel of the interface, … | |
Re: The answers given by the OP are correct, that is, 1: B & D and 2: B. The explanation is as follows: 1) The Linux naming convention for hard-drives has the first two letters to identify the kind of hard-drive it is, usually "hd" for normal hard-drive and "sd" for … | |
Re: > So how can I distinquish the difference? In other words, how can I figure out which kind of `T**` they are passing? You can't. There is no difference between `T**` (pointing to an array of arrays) and `T**` (pointing to a pointer to a T variable) from a type … | |
Re: Normally, I would direct people either to the C++11 threading library or to its precursor, the Boost.Thread library, as the best, most portable and easiest multi-threading library to use. However, these will certainly not work with Turbo C++ 3.0. Your best chance is with the [Win32 API](http://msdn.microsoft.com/en-us/library/vstudio/bb384843.aspx) functions. To create … | |
Re: I think LibreOffice works OK for most practical purposes. I'm not sure how good their database program (LibreOffice Base) is though. I've used it a little bit, it seems fairly basic, but I have never used MS Access, so I have no basis for comparison. How do you find it … | |
Re: > The collision is only inside the model, ... > the normals on the model pointing out as it should be. ... > you can se inside it but not inside out ... > collision works great from the outside. ... > The collision is only intersecting the triangles inside … | |
Re: Well, for one, you must always turn on all the warnings (`-Wall`) when compiling your code, and most compilers will warn you when you are using uninitialized variables, or that a variable might be uninitialized at some point. If the type is not a trivial type (int, double, etc.., and … | |
Re: > we even get some very minimal traffic from North Korea. Just because people from North Korea may visit DaniWeb can't possibly mean that we have to uphold North Korean internet and privacy laws!! But it does mean that the site should be usable from a Windows 95 computer. ;) ![]() |
The End.