3,183 Posted Topics
Re: > Because your compiler thinks using ctime is such a bad, bad idea that it's not going to let you do it unless you specifially tell it to let you. Actually, that's just a warning. He (wisely) has warnings set to fire as errors, but in the case of 4996, … | |
Re: > Note, I am NOT trying to correct this problem here, just warning people what to be careful about. I fail to see how this warning has anything to do with Windows 8 (or 8.1). As the end user it's your job to specify what you want and verify that … | |
Re: Yes, of course it's possible. In fact, any time you have an "is it possible?" question in C++, the answer is invariably yes. > don't be confused in database application and file oriented application . I appreciate your vote of confidence in our ability to tell the difference between files … | |
Re: It sounds like you've got a dependency on .NET that's not available in Mono. Try running [MoMA](http://mono-project.com/MoMA) on the assembly to see if there are any issues. | |
Re: > Why not use a DateTimePicker control, instead of your scheme of dates and times? It seems like he wants something more like a visual calendar (similar to Outlook). A DateTimePicker might be part of that, but not sufficient for the whole solution. | |
Re: Please specify what you mean by "help". Because what you've posted so far suggests you want someone to do work for you, which isn't what Daniweb does. | |
Re: > i have read so many places that reference is const pointer. Not so much. While it may help to think of references as constant pointers where indirection is done for you, eventually that relation will fall short. Here are a couple of notable differences: * A const pointer can … | |
Re: These examples are hideous. But let's break it down. (((i+=3)&&(i++>6))||((++i>8)&&(i+=3)) `i` starts as 3. Then it's immediately incremented by 3 (making it 6) and tested against 0. 6 is not equal to 0, so the first half of the `&&` clause succeeds. `i` is not greater than 6 so the … | |
Re: What compiler and version are you using? | |
Re: > i ment to put c i just changed it to counter so you guys knew what it was That's a hint that it should be `counter` in the first place rather than `c`. | |
Re: `fun` returns a reference to a static object, which you then set to 30. Subsequent calls to `fun` will return the same object, and you'll get the same value that you set. | |
Re: > So what is the answer ? The answer is "it depends". You need to consider several issues stemming from the platform and compiler, including but not limited to: * Are the combination of operators you use to mimic multiplication faster than multiplication on your target platform? * Does the … | |
Re: The good news is you can do it. The bad news is you have little choice but to use a platform dependent method to set the console into a wide character mode. For example: #include <iostream> #include <fcntl.h> #include <io.h> using namespace std; int main() { _setmode(_fileno(stdout), _O_U16TEXT); wcout << … | |
Re: The smallest I can think of that doesn't enter the realm of IOCCC and actually opens a form is: using System.Windows.Forms; static class Program { static void Main() { Application.Run(new Form()); } } The bare minimum for a more realistic production quality application in my opinion would be: using System; … | |
Re: Daniweb is not a homework for free service. Please show some proof of effort if you want help. | |
Re: Imperative, procedural, declarative, functional, object-oriented...there are many programming paradigms. C++ is largely imperative (inherited from C), supports OOP, and has been introducing functional aspects lately. Try looking at Wikipedia for "programming paradigm". | |
Re: Hop into your [edit profile](http://www.daniweb.com/members/edit_profile) page and make sure that "automatically watch articles I post in" is checked. If it is, look for that thread in your [watched articles](http://www.daniweb.com/members/watching) page. I'd wager that you're simply not watching the article, so you won't get new post notifications. | |
Hopefully I shouldn't need to explain what `gets` is or why it's easily one of the worst possible standard functions you could call in your code. In my personal opinion, the title for "holy shit, never use this function" is a tie between `gets` and `system`. I'll discuss the problem … | |
Re: Well, for starters, the example value exceeds a signed 32 bit range, so you have no choice but to bump up to a 64 bit entity. Let's assume that you're reading exactly 1 billion of these values. That means you need to store 1 billion 8 byte entities, which is … | |
Re: The answer is the same as when you asked [last year](http://www.daniweb.com/community-center/daniweb-community-feedback/threads/425056/why-are-databases-listed-under-web-development). The organization of forums are an artifact of history, and Dani hasn't applied many changes to it in favor of the tagging system. ![]() | |
Re: \*nix is a colloquialism to describe POSIX-based operating systems such as Unix or Linux. | |
Re: > Chr(e.KeyCode) always returns capital letters Yes, because the KeyCode property doesn't include shift state. There's also a Shift property for [KeyEventArgs](http://msdn.microsoft.com/en-us/library/System.Windows.Forms.KeyEventArgs_properties(v=vs.110).aspx) that tells you whether the shift key was pressed (and Alt, and Ctrl). You might consider whether the KeyData or KeyValue properties suit your needs better. | |
Re: > Prevents me from having to scroll up to figure out which block this bracket belongs to. Unless you're on a painfully small resolution monitor, you might consider that your blocks are too large. ;) Also note that most code editors these days will highlight the opening and closing braces. … | |
Re: A friend can see private members. If you don't want to allow that then you'd have to work through the public or protected interface rather than friendship. | |
| |
Re: Occurrences is easy enough with a `map`: #include <iostream> #include <map> using namespace std; int main() { map<int, int> values; int x; while (cin >> x) { ++values[x]; } for (auto it : values) { cout << it.first << ": " << it.second << '\n'; } } For scale you'll … | |
Re: What version of gcc are you using? `stoi` exists in C++11, but that doesn't mean your compiler is sure to support it. | |
Re: Seeing the actual error would help, but I suspect it's coming from line 40. The `ostream` class doesn't expose a public default constructor. Really your only option is to pass in a pointer to a `streambuf` object that handles all of the nitty gritty details of reading from the stream. … | |
Re: Are you sure the previous output isn't scrolling out of the console buffer? Put a pause every hour and you'll probably see all of the output. | |
Re: I'd start by assuming that the day in the range is always 01 (the first day of the month). This isn't an actual requirement, but it simplifies things initially. One question I'd ask is if the day is beyond 01, does that month count, or do you skip to the … | |
Re: I'd use a tuple for heterogenous and/or fixed aggregates. Otherwise I'd use a list. Of course, there are always exceptions, but that's a generally universal guideline. | |
Re: In this case you need to use the constructor's initialization list because there's no default constructor for `test1`: test2() : mytest1("test", 6) { } | |
Re: It's on the list. IIRC it's kind of tricky to calculate the size of the hover area and scroll accordingly. | |
Re: It really depends on both the library used to access the database and how the database itself works. Typically though, I'd lean toward the data going directly into the database. | |
Re: Start by printing a block of x's: for (int i = 0; i < 9; i++) { for (int j = 0; j < 15; j++) { cout.put('x'); } cout.put('\n'); } From there you can play around with ideas on how to identify the corner blocks and instead of printing … | |
Re: Oftentimes we'll even catch and handle such things before even seeing the report. That happens for me, if it even gets reported before we catch it. ;) That said, if you ever see spam or rule violations, please don't hesitate to report them with the flag bad post feature. That … | |
Re: Help yes, do it for you no. Please show some proof that you've made an honest attempt to do this homework problem on your own. | |
Re: The best tree algorithm depends on what you want to do. So...what do you want to do? :) | |
Re: > Do I have to create additional for loops statements for each digits and check for comma's/decimal? If you want to do it manually, yes. However, input streams already support this feature by imbuing the stream with a locale that can recognize a thousands separator. The default "C" locale won't, … | |
Re: > but as you should understand already, this is a rather undocumented section of programming Actually, it's very well documented if you know what to look for. Specifically, when directly writing machine code you need to do two things: 1. Understand and create the formatting of PE (Portable Executable) files. … | |
Re: Yes. What code do you have so far? Please note that nobody will do this for you. | |
Re: You can set SelectedIndex, if that's what you're asking. | |
Re: > And, we aren't tricked that easily either. A good thing to mention. A lot of us have been posting to forums like this for many years. We've seen a *lot* of good tricks and even more bad tricks. For the most part, we can tell the difference between an … | |
Re: > Should I loop through tiles and delete each one? Or is there a better way? Yes, and. :) With your current setup, you have little choice but to loop through the vector and `delete` each pointer. However, a better setup would be to use smart pointers (`shared_ptr` or `unique_ptr`) … | |
Re: Break down the requirements into manageable chunks. I'd do it like this: 1. Play a single round of HiLo with numbers from 1 to 100. 2. Modify the program to play infinite rounds. 3. Modify the program to keep score or wins and losses. 4. Modify the program to let … | |
Re: I'll second Pelles C as a pure C compiler. That said, I don't currently use it because I switch between C and C++ a lot, and a C++ compiler (pretty much all of them are bundled with a C compiler) works better for my needs. If you ever plan to … | |
Re: There's a strong chance that what you want to do is illegal. How old is your child? Do you own the computer? | |
Re: > when is a destructor of a class called? When the object goes out of scope or a pointer to the object is deleted. > I'm assuming that when I pop a vector, that will make the pointer no longer valid, is this where the destructor gets called? Yes, assuming … | |
Re: With C++11 it's super trivial: vector<string> v{ "123456789", "12345" }; long long result = 0; for (auto x : v) { reverse(begin(x), end(x)); result += stoll(x); } Of course, you *do* need to take into consideration whether the summed values will fit in the result. You may want to consider … |
The End.