6,741 Posted Topics

Member Avatar for Narue
Member Avatar for shyla

[B]>for (int i; i < 5; i++)[/B] i is not initialized to anything, it's the cause of error 2. Might I suggest initializing it to 0? [B]>(ae.Message);[/B] This doesn't do anything, it's the cause of error 2. Most likely you wanted to print ae.Message or log it somewhere.

Member Avatar for abelLazm
0
756
Member Avatar for rohitamitpathak

[QUOTE]and adding my own concept in rsa[/QUOTE] Which, unless you're quite a skilled cryptanalyst, will probably ruin the algorithm's strength. [QUOTE]Is there any technique by use of that i can compact this string[/QUOTE] A typical way to compact cipher text is converting it to a base-64 string. This has the …

Member Avatar for rohitamitpathak
0
172
Member Avatar for rannamaa

[QUOTE]if there is no name in an entry isnt that entry null then?[/QUOTE] It depends, but the generally safe assumption is that the entry only contains what you explicitly store there. If you didn't initialize the entry to a null value, it's unwise to assume that an empty entry will …

Member Avatar for rannamaa
0
117
Member Avatar for c++lover

Just to be clear, you're actually using MS-DOS as an operating system, right? Not some flavor of Windows?

Member Avatar for chrjs
-1
176
Member Avatar for sha11e

[QUOTE]First of all, is the "COORD coord" neccesary? :/[/QUOTE] Presently, yes. In the next C++ standard there are alternatives though. [QUOTE]"GetStdHandle(STD_OUTPUT_HANDLE), coord)" What's this part? What does it really do?[/QUOTE] Basically, it gets a handle you can use to write to the console. SetConsoleCursorPosition then uses that handle and the …

Member Avatar for sergent
0
9K
Member Avatar for nxt200

You're not likely to get anyone to run an unknown executable. Provide the code so that we can compile and run it after determining that it's safe and you'll get better responses.

Member Avatar for sfuo
0
131
Member Avatar for osirus0830

[QUOTE]Do I need to use cin.get() after each use of cin?[/QUOTE] That's the most naive way of dealing with the issue. The problem is that cin's >> operator may leave a newline character on the stream for getline (or the sibling get) to terminate immediately on. Ideally you would read …

Member Avatar for Narue
0
99
Member Avatar for Muhammad Anas

Since you have no qualms about reading the file multiple times, just go through it once more character-by-character to grab the whitespace and non-whitespace counts. Then you'd have three loops: [list=1] [*]Read line-by-line and increment the line count [*]Read word-by-word and increment the word count [*]Read character-by-character and increment the …

Member Avatar for Narue
0
2K
Member Avatar for Lokril

I don't think you interpreted the requirements correctly. The way you've explained this program, it should take user input in a loop rather than calculate a range from user input: [code] #include <iostream> bool user_input(int& value) { std::cout<<"Enter a whole number: "; return std::cin>> value && value >= 0; } …

Member Avatar for Lokril
0
216
Member Avatar for cse.avinash

The only common alternative is standard a macro that evaluates to the same thing: [CODE] #include <stdlib.h> int main(void) { return EXIT_SUCCESS; } [/CODE] In C99 you can omit the return statement and 0 will be assumed: [code] int main(void) { /* return 0; is implicit */ } [/code]

Member Avatar for Narue
0
101
Member Avatar for Wesleyy

I think that's quite enough from all of you. Wesleyy, your question would be better suited to the [URL="http://www.daniweb.com/hardware-and-software/microsoft-windows/windows-software/92"]Windows Software[/URL] forum, but rather than move this growing flame fest, I think it would be better for you to create a new thread in the appropriate forum (using lessons learned from …

Member Avatar for Narue
-2
157
Member Avatar for owenransen

[QUOTE]However, when you don't need random-access, i.e., you are just traversing the vector from start to finish, then, if you use the iterator version, and you later realize that you could use another container instead of a STL vector, and that new container might not be random-access, then you won't …

Member Avatar for mike_2000_17
0
165
Member Avatar for dyingatmidnight

That's an artifact of how you're displaying the value, not the value itself. The only solid way would be to convert your value to a string using the same formatting modifiers, then count how many digits show after the radix.

Member Avatar for Narue
0
90
Member Avatar for apanimesh061

[QUOTE]This is syntax that I get when I make any Win32 Console Application in Visual C++.[/QUOTE] When writing standard C++, I always start with an empty project. That way I don't have to undo all of the Microsoftisms to make my code portable. But all of the T* stuff is …

Member Avatar for Narue
0
193
Member Avatar for maybnxtseasn

[QUOTE]Is there ANY EVER reason why i would return an object or variable by reference?[/QUOTE] Yes, certainly. However, there's a strong distinction between returning by reference and returning by [I]const[/I] reference. The latter gives you all of the potential performance benefits of returning by reference without the potential to lose …

Member Avatar for Narue
0
160
Member Avatar for maybnxtseasn

Best practice is to include the exact header you need in each file it's needed. For example: [code] #ifndef EXAMPLE_H #define EXAMPLE_H // example.h #include <string> std::string foo(); #endif [/code] [code] // example.cpp #include <string> #include "example.h" std::string foo() { // ... } [/code] [code] // main.cpp #include <iostream> #include …

Member Avatar for Narue
0
112
Member Avatar for Dosik

I don't know what's more pathetic. The fact that you're so unethical that you would even [I]have [/I]this kind of business practice, or the fact that you're recruiting for equally unethical people on the very forums you intend to troll with your spam.

Member Avatar for Deniwillson
-2
173
Member Avatar for sha11e

[QUOTE]Isn't there a better way?[/QUOTE] Not really. You can take raw input and gain more control over exactly what characters are accepted, but that has its disadvantages as well. Typically, reading unformatted input as a string, then validating it and responding accordingly is the recommended approach.

Member Avatar for Derek Elensar
0
157
Member Avatar for techie1991

[QUOTE]The static declaration, applied to an external variable or function, limits the scope of that object to the rest of the source file being compiled.[/QUOTE] The term "file" is somewhat misleading. The correct term is "translation unit", which is the fully preprocessed input to your compiler. Because of headers, multiple …

Member Avatar for techie1991
0
236
Member Avatar for smrati.katiyar

If you don't define any constructors, the compiler will generate a default constructor for you (or make it appear as if one was generated). However, the instant you define an explicit constructor, that default constructor is not longer created. As for why your class needs an explicit default constructor, clearly …

Member Avatar for Narue
0
726
Member Avatar for mitmehta22

[QUOTE=abhimanipal;1538305]I dont know if this is of any consequence or not but why do you have %*c in your fscanf ?[/QUOTE] Probably to remove the comma. The asterisk in scanf means to match the specifier, then discard the result rather than store it in a variable.

Member Avatar for abhimanipal
0
7K
Member Avatar for anirudhruia
Member Avatar for Derek Elensar

The standard says that angle brackets cause the compiler to look in an implementation-defined location and double quotes cause the compiler to look in an implementation-defined location. I can see how there might be confusion. ;) Traditionally the angle brackets searched the compiler's include locations followed by local directories, while …

Member Avatar for Derek Elensar
1
13K
Member Avatar for Agni

I'm not sure I understand the question. Can you give an example of what you expect to happen?

Member Avatar for Agni
0
327
Member Avatar for TheTechWookie

[QUOTE]How do you handle these types of requests?[/QUOTE] I would require them to fill out a software request form with business justification. Then if the justification doesn't have a suitable ROI for the license and maintenance costs, that would give me a defensible position for rejecting the request.

Member Avatar for jwenting
0
359
Member Avatar for jingda

I'll bet the guy has links in his signature. Spammers like to do this to raise their page rank in search engines. However, Daniweb doesn't expose signature links to search engine web crawlers, so the net effect of these spam posts is a little valueless fluff added to the thread. …

Member Avatar for Portgas D. Ace
0
289
Member Avatar for aaronmk2
Member Avatar for gman1991

You're printing the addresses of variables rather than the values. scanf and printf are not the same.

Member Avatar for gman1991
0
109
Member Avatar for wildplace

Pointers are very consistent in their behavior. Your problem can be simplified by removing a level of indirection: [code] void changePTR(int p) { p = 100; } int main() { int p = 1; cout<< p <<'\n'; changePTR(p); cout<< p <<'\n'; } [/code] Since p is passed by value (ie. …

Member Avatar for wildplace
0
96
Member Avatar for lochnessmonster

I'd create two constructors: one that takes a process ID and validates it, and one that takes a process name and finds the ID. getProcessID could be a private member function that the constructor defers to, but otherwise doesn't need to be exposed to client code. With the information given, …

Member Avatar for mike_2000_17
0
127
Member Avatar for Violet_82

[QUOTE]But the number I need need to be respectively smaller than 4 and 13, so what happens if the number that we get from the clock is bigger than those?[/QUOTE] Completely irrelevant. You use srand to seed the random number generator. The current time is typically used because it's constantly …

Member Avatar for Violet_82
0
4K
Member Avatar for wildplace

[QUOTE]btw, i dont want to change the input type from long to char[/QUOTE] Do you mind an intermediate step where the input is taken as a string and then converted to long? You'd have much more control that way: [code] #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> int main(void) …

Member Avatar for Narue
0
156
Member Avatar for esraa waqfi
Member Avatar for e-papa

Right now? I'm good. I'm actually working on a project that involves writing new code, so I'm quite content. Prior to this I was doing client implementations and support, which is slightly less enjoyable than being repeatedly punched in the face.

Member Avatar for e-papa
0
138
Member Avatar for newbiecoder

Books and "hanging out" don't build experience, writing code builds experience. Think of a few projects that seem within the realm of your capabilities and follow them through to completion.

Member Avatar for awie10007
0
268
Member Avatar for dalk8978

Assuming character is an array of char and numbers is an array of int: [code] printf("%c %d\n", character[i], character[i]); printf("%d %c\n", numbers[i], numbers[i]); [/code]

Member Avatar for Narue
0
34
Member Avatar for ThePythonNoob
Member Avatar for Narue
0
83
Member Avatar for daviddoria

[QUOTE]My interpretation of this is that comments are handled BEFORE macros like #if. Comments are parsed first and turned into whitespace. Thus the /* and */ take precedence over #if and #endif.[/QUOTE] That's my interpretation as well, except from the standard's specified phases of translation instead of Wikipedia.

Member Avatar for daviddoria
0
135
Member Avatar for rhythm1576

"rhythm" is already taken. Do you have any alternatives that are less common?

Member Avatar for Narue
0
50
Member Avatar for waqarafridi

[QUOTE]The str is a Constant String, I want to Convert it to character array.[/QUOTE] To what end? What does a character array have that the string doesn't? As L7Sqr stated, there's no string type in C. Strings are represented by "arrays" of char, where the last character is '\0' and …

Member Avatar for waqarafridi
0
5K
Member Avatar for Behi Jon

[B]>I want to know what is allocator in C++ STL exactly ?[/B] An allocator doles out blocks of memory using a standardized interface so that we can switch the allocation method quickly and easily. For example, we can go from using the standard allocator to using a memory pool simply …

Member Avatar for arkoenig
0
146
Member Avatar for Dexxta27

These functions stem from the guideline that data members should be kept private to avoid losing control over your data. For example: [code] #include <iostream> #include <string> class CellPhone { public: std::string number; CellPhone(const std::string& number): number(number) {} }; int main() { CellPhone myPhone("555-123-4567"); std::cout<< myPhone.number <<'\n'; myPhone.number = "Haha, …

Member Avatar for Dexxta27
0
135
Member Avatar for aaisha

>i wud luv to do it myself. but i dunno where to start dis frm! Yea, don't do that anymore. Silly abbreviations make your posts harder to understand, especially for non-native English speakers.

Member Avatar for Narue
0
2K
Member Avatar for tracydo

You can certainly ask questions about flowcharting. The best place would probably be the [URL="http://www.daniweb.com/software-development/computer-science/14"]Computer Science[/URL] forum.

Member Avatar for tracydo
0
123
Member Avatar for TrustyTony

Python is designed to be friendly and concise, though for this problem I wouldn't say that C++ fares too badly in the comparison: [code=c++] #include <algorithm> #include <cctype> #include <cstdlib> #include <ctime> #include <functional> #include <fstream> #include <iomanip> #include <iostream> #include <iterator> #include <sstream> #include <stdexcept> #include <string> #include <vector> …

Member Avatar for TrustyTony
0
633
Member Avatar for abelLazm

In your control panel, under the Reputation and Infractions tab, you can look at all of the warnings and infractions applied to your account (both active and expired). As well as the private message sent for any moderation activity, you can get an overview of the where and when of …

Member Avatar for Narue
0
93
Member Avatar for mafiasam
Member Avatar for Portgas D. Ace
1
264
Member Avatar for mashar

It would be unwise to return a local array. In my experience, the best solution is to accept the array as a parameter rather than try to return it.

Member Avatar for mashar
0
142
Member Avatar for yongj

[QUOTE]I am confused on how to implement the class functions[/QUOTE] That's really the trick, isn't it? Have you worked out the logic for these operations and just have trouble putting it into code, or are you drawing a complete blank on how to proceed?

Member Avatar for VernonDozier
0
137

The End.