6,741 Posted Topics
Re: [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. | |
Re: [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 … | |
Re: [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 … | |
Re: Just to be clear, you're actually using MS-DOS as an operating system, right? Not some flavor of Windows? | |
Re: [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 … | |
Re: 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. | |
Re: [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 … | |
Re: 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 … | |
Re: 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; } … | |
Re: 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] | |
Re: 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 … | |
Re: [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 … | |
Re: 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. | |
Re: [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 … | |
Re: [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 … | |
Re: 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 … | |
Re: 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. | |
Re: [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. | |
Re: [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 … | |
Re: 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 … | |
Re: [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. | |
| |
Re: 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 … | |
Re: I'm not sure I understand the question. Can you give an example of what you expect to happen? | |
Re: [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. | |
Re: 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. … | |
Re: You're printing the addresses of variables rather than the values. scanf and printf are not the same. | |
Re: 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. … | |
Re: 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, … | |
Re: [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 … | |
Re: [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) … | |
Re: We won't know until you give more information. | |
Re: 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. | |
Re: 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. | |
Re: 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] | |
Re: Please don't bump your threads. It's unfair to the owners of other threads. | |
Re: [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. | |
Re: "rhythm" is already taken. Do you have any alternatives that are less common? | |
Re: [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 … | |
Re: [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 … | |
Re: 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, … | |
Re: >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. | |
Re: 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. | |
Re: 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> … | |
Re: 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 … | |
| |
Re: 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. | |
Re: [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? |
The End.