3,183 Posted Topics

Member Avatar for dovlet.eminov

**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.

Member Avatar for rajii93
0
298
Member Avatar for pooja_4

> 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.

Member Avatar for Faizal Shariff
1
297
Member Avatar for Parthptl

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"); …

Member Avatar for Fenrir()
0
134
Member Avatar for ivan3510

`&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 …

Member Avatar for ivan3510
0
205
Member Avatar for catastrophe2

> 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.

Member Avatar for catastrophe2
0
1K
Member Avatar for Mohammed_9

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.

Member Avatar for Mohammed_9
0
132
Member Avatar for Pepp

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.

Member Avatar for Pepp
0
249
Member Avatar for Ezekiel_1

> 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. …

Member Avatar for Ezekiel_1
0
458
Member Avatar for hassan.kiani.10

> 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 …

Member Avatar for talha ijaz
0
213
Member Avatar for Mart_webber

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 …

Member Avatar for Mart_webber
0
166
Member Avatar for ravi_14

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 …

Member Avatar for deceptikon
0
191
Member Avatar for Mohammed_9

> 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.

Member Avatar for 2teez
0
249
Member Avatar for xednycrex

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.

Member Avatar for xednycrex
0
204
Member Avatar for admiri92

> 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.

Member Avatar for mike_2000_17
0
291
Member Avatar for ponedelnik

> 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. ;)

Member Avatar for deceptikon
0
159
Member Avatar for saja.omarii.7

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 …

Member Avatar for saja.omarii.7
0
4K
Member Avatar for Stanley_3

> how can i get free online product key for window 8 Discussion of illegal activities is not allowed on Daniweb.

Member Avatar for deceptikon
0
146
Member Avatar for 21345570
Member Avatar for mystycs

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 …

Member Avatar for David W
0
19K
Member Avatar for 21345570

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.

Member Avatar for deceptikon
-1
86
Member Avatar for Vasthor

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 …

Member Avatar for deceptikon
0
253
Member Avatar for Amoh

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.

Member Avatar for rubberman
0
86
Member Avatar for Teezy7

> 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 …

Member Avatar for deceptikon
0
376
Member Avatar for rock9449

> 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

Member Avatar for deceptikon
0
8K
Member Avatar for fmtelepe

Modern education at its finest. The field's founding members are weeping.

Member Avatar for deceptikon
-3
61
Member Avatar for thapzizo
Re: c#

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.

Member Avatar for deceptikon
0
101
Member Avatar for damte38
Member Avatar for 21334929
Member Avatar for tux4life

> 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.

Member Avatar for Remy1990
0
8K
Member Avatar for YA RAMSAMKER

> but can an abstract class be instantiated ? No. That's the point, you're forced to derive from an abstract class.

Member Avatar for YA RAMSAMKER
0
162
Member Avatar for rithish

> factorial(x--,y*z,z++); You're passing the current value of x to factorial(), recursion never stops and you experience a stack overflow.

Member Avatar for Reverend Jim
0
154
Member Avatar for chipo

> 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 …

Member Avatar for David W
0
160
Member Avatar for COKEDUDE

> 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 …

Member Avatar for Ancient Dragon
0
264
Member Avatar for NardCake

> 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 …

Member Avatar for NardCake
0
848
Member Avatar for tadas.bareikis

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 …

Member Avatar for Schol-R-LEA
0
205
Member Avatar for nitin1

> 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 …

Member Avatar for ShapesInClouds
0
3K
Member Avatar for churchill.omorere

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.

Member Avatar for deceptikon
-1
110
Member Avatar for Ghost

> 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 …

Member Avatar for vasanthmc2
1
10K
Member Avatar for kCoder

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.

Member Avatar for JorgeM
0
133
Member Avatar for SivaKing

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.

Member Avatar for rubberman
0
311
Member Avatar for gsgikgsgik
Member Avatar for Vikram Sehgal

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"; }

Member Avatar for deceptikon
0
517
Member Avatar for Abdul_23

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.

Member Avatar for Abdul_23
0
201
Member Avatar for Vasthor

> `TextQuery(inFile);` You're not defining an object there. Try this instead: TextQuery tq(inFile);

Member Avatar for Vasthor
0
361
Member Avatar for alaa ashraf

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.

Member Avatar for codeMonkey94
0
106
Member Avatar for Mike_danvers

We already have a chat feature. On the footer bar you'll find one quick way to get to it (the Chat button).

Member Avatar for Mike_danvers
0
217
Member Avatar for gabrielcastillo

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 …

Member Avatar for Reverend Jim
0
235
Member Avatar for kent.johnstone_1

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 …

Member Avatar for rubberman
0
278
Member Avatar for fahadmunir32

> 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 …

Member Avatar for rubberman
0
526
Member Avatar for virupax

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.

Member Avatar for deceptikon
0
449

The End.