You can not test two floats or doubles for equality due to possible rounding errors in memory variable.
You can, but it gets hairy very quickly.
You can not test two floats or doubles for equality due to possible rounding errors in memory variable.
You can, but it gets hairy very quickly.
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.
*sigh*
What other languages support is irrelevant, this is C. While I can understand the confusion, that doesn't change the importance of making it clear what's standard C and what's not.
actually till now we dont use string::size_type :(
Till now, that's what we call learning. ;) size_type
is the type string::find
returns, and it's the type string::substr
accepts.
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 <iostream>
#include <string>
using namespace std;
int main()
{
string sentence;
cout << "enter a three-words sentence :";
if (getline(cin, sentence))
{
string::size_type middle_begin = sentence.find(" ") + 1;
string::size_type middle_end = sentence.find(" ", middle_begin);
string middle = sentence.substr(middle_begin, middle_end - middle_begin);
cout << "'" << middle << "'\n";
}
}
how can i get free online product key for window 8
Discussion of illegal activities is not allowed on Daniweb.
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.
What version of the framework are you running in your project? This library was added in .NET 3.0.
32 or 64 bit? With 32 bit you have a hard 4GB limit, 3GB and change of which would be usable to applications. For 64 bit that physical limit is raised to between 8GB and 192GB depending on your specific version of Windows 7:
Home Basic: 8GB
Home Premium: 16GB
Everything Higher: 192GB
Home Starter has a hard limit of 2GB and 32 bit, but it's somewhat rare to see that version in the wild because it's so very limited.
I'd actually recommend against learning your first two languages simultaneously because you're also learning programming in general at that time. Too much information, some of it guaranteed to be conflicting due to varying syntax rules, will prove to be confusing and slow your progress.
So if you're happy with Python so far, keep learning just Python until you feel sufficiently learned or have need for a different language. That's my advice.
Once you reach that point, unless you need something different, of course, my suggestion would be Java, C#, or VB.NET.
You might be able to find something on codeproject.com, but for very specific tasks like this it's unreasonable to expect there to be a walkthrough. The most significant part of programming is solving problems with the tools you have and the creativity to put them together.
Yes, you can do that. The controller that delivers your page can check the date and either deliver the voting page or an error page depending on whether the date falls into range of your voting period.
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.
You specifically mentioned gaming. While it doesn't hurt to learn web development, it's not directly relevant to your goals.
When used as an expression, cin
results in an istream reference that can be used in boolean context to determine its state. if (!cin)
is basically the same as if (!cin.good())
. Likewise, the >>
operator will evaluate to the istream reference, hence if (!(cin >> value)
corresponds to if (!(cin >> value).good())
or
cin >> value;
if (!cin.good())
why are you using ios header file ?
That's where the std::streamsize
typedef is defined. Typically <ios>
will be included along with <iostream>
, but it's not strictly portable to rely on that behavior.
Okay, so let's examine why Python isn't doing it for you. Since you seem unsatisfied, why is that?
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 Javascript extensively. Those three are the bare minimum for general web development.
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.
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 is to become a pro are as follows:
C# can be used outside of Windows, of course, but the .NET framework is by far the more common target.
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 a positive number: ";
}
cout << "You entered " << value << '\n';
}
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.
its a perfect program of time conversion
Well, it's not horrible, but I wouldn't use the word "perfect" as a descriptor. You could start by learning to format your code in a sane manner.
Modern education at its finest. The field's founding members are weeping.
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.
By second programming language do you mean a language you know but don't really use? It seems kind of silly to think in terms of first, second, third, etc...; you should learn as many languages as practical to benefit your skillset.
So let's start with this: what language do you already know?
Do your own homework, please.
Do your own homework, please.
What is Google?
but can an abstract class be instantiated ?
No. That's the point, you're forced to derive from an abstract class.
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 leading underscores are always reserved though.
That said, best practice is to avoid leading underscores in general, unless you're very familiar with the rules of reserved identifiers.
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 through to provide even remote reliability since the most common implementation (all of them that I'm aware of) diddles with the stack.
VLAs are a great idea in theory. In practice, they've been less than stellar. Sadly, the standard VLA model is no better than alloca
. So I typically recommend against using them in favor of a more traditional dynamic array using malloc
.
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 just a small portion of the resources available. ;)
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.
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.
Please read our rules concerning homework.
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";
}
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 than the whole project is also handy during development.
TextQuery(inFile);
You're not defining an object there. Try this instead:
TextQuery tq(inFile);
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.
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.
Such is the way with spellcheck. Never accept a suggestion blindly, or you might end up posting something as embarrasing as it is amusing. ;)
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.
For the most part, whitespace in C is ignored. All three of your examples are functionally identical. You could also say const char*buf
and it'll work fine because the tokens aren't ambiguous. However, constchar
won't work.
Another bit of trivia is that const
doesn't have to go before the type: char const *buf
. This can make declarations easier to decipher as they're typically read inside out and right to left: char const * const buf
reads as "buf is a const pointer to const char".
Put simply, those providers aren't installed by default. Typically, installing this as a prerequisite solves the problem.
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 misleading beginners.
No offense intended, but after a quick reading of that blog, I'd question your qualifications to teach. For example, if it's just a matter of simplifying things, can you explain what parts of this entry are not entirely correct and why?
We already have a chat feature. On the footer bar you'll find one quick way to get to it (the Chat button).
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 const char
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 don't try get no respect. And yes, after well over a decade of particupating in forums such as Daniweb, I can tell the difference. ;)
Are we talking about working with OpenXML directly or through an SDK?