3,183 Posted Topics
Re: **i**nput **o**utput **stream**. Concerning the header, `iostream` is where your `cin` and `cout` objects are declared. In general, the iostreams library is C++'s character streaming I/O support mechanism. | |
Re: > i want the code for this program using arrays Then write it. Also, please read our rules concerning homework questions without proof of effort. We won't do these problems for you, but we'll help if you get stuck doing it yourself. | |
Re: Only open the form if the login is correct: if (username == textBox1.Text && password == passwordtextbox.Text) { MessageBox.Show("You are now successfully logged in."); Form2 frm = new Form2(); frm.Show(); frm.mypass = password; frm.myid = username; } else { MessageBox.Show("Username or Password seems invalid, please use email to recover password/username"); … | |
Re: `&a` evaluates to a pointer to `int` rather than `int`, therefore a reference to `int` is an incompatible type. Further, returning a reference to a non-static local variable is an extremely bad idea because the local variable is destroyed after the function returns; the reference will refer to a non-existent … | |
Re: > You can not test two floats or doubles for equality due to possible rounding errors in memory variable. [You can](http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm), but it gets hairy very quickly. | |
Re: From the end of the string walk backward until you find a non-blank character, then overwrite the last blank you saw with `'\0'`. Easy peasy, and [here's a working example](https://code.google.com/p/c-standard-library/source/browse/src/std/string.c#548) of an rtrim function to get you rolling. | |
Re: What kind of "help" are you looking for? Daniweb requires proof of effort for homework questions, and I don't see any such proof. Please give it an honest try, and feel free to ask for help (that doesn't constitute doing your work for you) if you get stuck. | |
Re: > For working with money, always best to use exact (large) whole numbers. Oddly enough, I *just* chastized a customer for implementing financial amounts as single precision floating point in a web service they wrote that one of our applications calls. The bug report was precision loss changing the values. … | |
Re: > You get to do the math! :-) For massive bonus points, incorporate chronological adjustments in your math (eg. leap years, leap seconds). Date and time calculations are shockingly complex when you look for higher correctness across the board. Most libraries even put a lower bound on supported dates to … | |
Re: Of course, since you still have the assignment and saying it's stupid won't accomplish much, a reasonable approach would be to compress your range with a loop and table lookup: int lookup[] = {21, 41, 61, 81}; int discount = 0; for (int i = 0; i < sizeof lookup … | |
Re: It largely depends on your compiler and switches. C++11 (the latest standard) added this feature, and some compilers prior to that offered it as an extension. Your book is old, by the way, and also written by an author who's routinely mocked for making grievous beginner mistakes. You might consider … | |
Re: > I think it is possible to do that, only that, the nested function is only been seen within the function in which they are defined. Not in standard C. If nested functions works for you then you're relying on a compiler extension. | |
Re: Those specs are fine, though more RAM never hurts. My dev machine at work has 8GB and my home PC has 16GB. A stronger CPU would be your second upgrade as necessary. | |
Re: > Usually you specify what exception type(s) it may throw. Noting of course that exception specifications have been deprecated because they're stupid. Support for exceptions themselves is still standardized and unlikely to change significantly in the forseeable future. | |
Re: > I hope that once in a while you visit non-English pages, don't you ? Only with translation unless it's a language I can reasonably read. ;) | |
Re: Reading the documentation for `substr` and `find` would be helpful, it highlights that the second argument is a count of characters, not a position in the string. `find` gives you the position in the string and also accepts a starting position, so a little munging of data is needed: #include … | |
Re: > how can i get free online product key for window 8 Discussion of illegal activities is not allowed on Daniweb. | |
Re: Here's a starting point: #include <ios> #include <iostream> #include <limits> using namespace std; int main() { unsigned value; cout << "Please enter a positive number: "; while (!(cin >> value) || value < 0) { if (!cin) { cout << "Invalid input\n"; cin.clear(); cin.ignore(numeric_limits<streamsize>::max(), '\n'); } cout << "Please enter … | |
Re: Try helping yourself next time. Your question is easy to answer with *any* C# reference. Generally we don't look kindly on what appear to be supremely lazy questions. | |
Re: C++ and C# are both imperative languages, so if you learn one, learning the other will be straightforward. The goal is to learn logic and problem solving; language syntax and libraries are a relative cake walk with a strong foundation in the basics. My recommendations for languages if your goal … | |
Re: The starting point is always the same: pick a language that interests you, and get a trusted resource (such as a book) to learn from. When you have specific questions, we'll be happy to help. | |
Re: > But by comparison to ASP.NET IDE development, Mvc requires the coder to have a better knowledge of browser resident languages, - html, css and javascript primarily. I'll have to disagree on that one. Any non-trivial site written in ASP.NET (using MVC or not) will likely use HTML, CSS, and … | |
Re: > Or, just simply call localtime() or gmtime(), which will put it in a structure for you. But, but that would defeat the purpose of reinventing (poorly) the behavior that someone worked very hard to implement in the standard library! ;p | |
Re: Modern education at its finest. The field's founding members are weeping. | |
Re: I use `sealed` for utility classes that have no business being extended. Some people go so far as to seal any classes that aren't explicitly intended to be extended, which is actually a reasonable approach. It makes your intentions crystal clear. | |
Re: > Here we used getch() which is not standard. How should I code without using getch() ? There's no standard way to simulate getch(). Pick your favorite non-standard option to replace it. | |
Re: > but can an abstract class be instantiated ? No. That's the point, you're forced to derive from an abstract class. | |
Re: > factorial(x--,y*z,z++); You're passing the current value of x to factorial(), recursion never stops and you experience a stack overflow. | |
Re: > Also, DO NOT use leading underscores for local variables. That construct is generally reserved for system libraries and such. Only at file scope in normal and tag name spaces. A single leading underscore is safe for local variables provided the second character is not an upper case letter. Double … | |
Re: > And it doesn't work in VS because Visual Studio's C support is completely outdated. So are standard VLAs. ;) You'll notice that C11 made them optional for the implementation. Be sure to check `__STD_NO_VLA__` to see if you're SOL. Even if they're available, you have some hoops to jump … | |
Re: > Instead I just create a new revision with a folder name plus an incremented number on the end. That's all well and good...until you want to know what changes you made and when. Then the history features of a source control are amazingly helpful. Rolling back specific parts rather … | |
Re: I learned by reading books on programming and teaching myself. These days the web is rife with tutorials, examples, tools (compilers and such), and pretty much any resource you need with a simple Google search. Hell, you could learn a lot just by reading the threads on Daniweb. And we're … | |
Re: > then where is the gcd time included in this complexity ? is it a constant according to you ? It's not a constant. And that's not according to me either, Euclid's GCD algorithm has been rigorously analyzed (you can find a fantastic treatise in [Knuth vol. 2](http://www.amazon.com/Art-Computer-Programming-Seminumerical-Algorithms/dp/0201896842)). The upper … | |
Re: Good luck! If you have any specific questions, feel free to ask. By the way, "I don't know where to start" is *not* specific. | |
Re: > this.Close() and also this.Dispose() causes an exception. Then I'd wager you have a problem in your cleanup code. Environment.Exit() probably works because it terminates the process in an unclean way for form applications. I'd further speculate that Application.Exit() fails as well, because it cleanly ends the application. In other … | |
Re: You're missing a `Main` method. Without getting too into detail about the nuances, any executable statements must be in a method. They won't work at the class or namespace level. | |
Re: What compiler are you using and what stuff from the header are you using? `conio.h` isn't a standard header, so it won't be supported by all compilers, or in the same way by compilers that have it. | |
Re: You need to open the file with a new name each time: for (int x = 0; x < 10; x++) { stringstream filename; filename << "trial" << (x + 1) << ".txt"; ofstream out(filename.str().c_str()); out << "save it"; } | |
Re: Structure definitions need to be terminated by a semicolon: struct node { int data; node *right; node *left; }; Without it, the compiler is treating the class definition as part of the structure definition, which is a syntax error. | |
Re: > `TextQuery(inFile);` You're not defining an object there. Try this instead: TextQuery tq(inFile); | |
Re: More information is needed. Moschops' answer is legit, but it would help greatly to know exactly what you want to do so that the answer can be tailored to your needs. | |
Re: We already have a chat feature. On the footer bar you'll find one quick way to get to it (the Chat button). | |
Re: Having studied a second language I understand how difficult it can be. Understanding English and linguistics in general I can certainly understand difficulties learning English (it's far from simple even if you grew up with it). I totally respect anyone who isn't a native speaker and still tries. Those that … | |
Re: The character(s) pointed to by `buf` are treated as read-only. To make the pointer itself `const`, place the keyword after the asterisk: char * const buf; // const pointer to non-const char const char *buf; // Non-const pointer to const char const char * const buf; // const pointer to … | |
Re: > i try to things the as simple as i can so every beginner can understand the logic of program. If by simple you mean very little extraneous fluff in the code, then that's good. However, it looks to me more like you're dumbing things down to the point of … | |
Re: Put simply, those providers aren't installed by default. Typically, installing [this](http://www.microsoft.com/en-us/download/details.aspx?id=13255) as a prerequisite solves the problem. |
The End.