6,741 Posted Topics
Re: This is a common problem with IDEs that don't artificially keep the window open for you. The actual problem is that the IDE creates a window to host your program, and when the program ends the window is destroyed. The solution is to force your program to continue running by … | |
Re: Your operations are out of order. Create a dialog object, initialize it, [i]then[/i] show it: [code] Info^ form = nullptr; try { form = gcnew Info(); form->name->Text = "Calculator"; form->infobox->Text = "Test"; form->ShowDialog(); } finally { if (form != nullptr) form.Dispose(); } [/code] This process makes the most sense from … | |
Re: [QUOTE]I could not find a Build menu in 2010 Express.[/QUOTE] You can also right click on the solution in the solution explorer for the "Clean Solution" command. Projects can be cleaned individually this way as well by right clicking on the project. | |
Re: [QUOTE]But how it is returning value to main, even we are not returning in code.[/QUOTE] You lied to the compiler and it's doing what you asked. The following says that calsum() returns an int: [code] int calsum(int a,int b,int c) [/code] Whether you actually return a value or not, the … | |
Re: Um...set_difference() already has an overload that takes a predicate. Your call will work as-is: [code] std::set_difference( A.begin(), A.end(), B.begin(), B.end(), std::back_inserter(C), [](morph const A, morph const B) { return A.num < B.num; }); [/code] | |
Re: Standard C++ doesn't support directory management, you'll need to use some sort of non-standard library. I'd suggest [URL="http://www.boost.org/doc/libs/1_47_0/libs/filesystem/v3/doc/tutorial.html#Directory-iteration"]Boost::filesystem[/URL] as a start. | |
Re: There shouldn't be any case where you have an array but cannot acquire its size unless your code was poorly designed. Please post some code and describe the program you're trying to write so that we have a little context to work with in helping you. | |
Re: [QUOTE][CODE]Lottery<int>Lotto();[/CODE][/QUOTE] Welcome to C++, where syntactic ambiguity means you declared a function rather than an object. Remove the parens from this declaration and Lotto will become what you intended it to be: [code] Lottery<int> Lotto; [/code] And array2 isn't visible in main(), it's a private member of the Lottery class. | |
Re: [QUOTE]So I don't think my do-while loop is right... I don't know how to keep shifting the structs down until the end though...[/QUOTE] The idea is to pretend the record being deleted is a hole in the array and fill it in with everything after it: [code] // Find the … | |
Re: What's the problem? You realize that we can't read your mind and you need to tell us what you're having trouble with, right? | |
Re: [QUOTE]is there any way to just throw, let's say the first line to null read the second line feed the third and fourth to null and read the fith?[/QUOTE] Just read the line into a variable and don't do anything with it. When you read the next line, the variable … | |
Re: The first problem is you read a number into x and print it out, but don't add it to the sum. The second problem is using fin.fail() as the loop condition, it's basically the same as [URL="http://www.gidnetwork.com/b-58.html"]using feof()[/URL], which is wrong. Try this instead: [code] // read text from file … | |
Re: [QUOTE]what is a _Bool variable?[/QUOTE] A variable of [URL="http://en.wikipedia.org/wiki/Boolean_data_type"]boolean type[/URL]. The keyword for a boolean type in C is _Bool. It holds only two values: 0 or 1, which correspond to false and true, respectively. C also provides a header called <stdbool.h> that defines more convenient macros: [ICODE]bool[/ICODE], [ICODE]false[/ICODE], and … | |
Re: Train A leaves the station at 4 p.m. 300 miles away, Train B leaves leaves at 6 p.m. If Train A travels 45 mph and Train B travels 60 mph, when will they meet? | |
Re: Certainly there's not a dedicated forum for secure coding, but discussions of such are on-topic in the [B]Software Development[/B] and [B]Web Development[/B] categories. Just because there's not a forum called <so and so> doesn't mean you can't start a thread discussing <so and so> in a forum that's "close enough". | |
Re: [B]>Anyway, you are perma-banned from daniweb.[/B] That's worked soooo well, as we can plainly see. I think it's high time for Dani to complain to Josh's ISP and see about getting his account dropped. If he can't connect to the web, he can't circumvent his forum ban, can he? | |
Re: [QUOTE]Hi, I just want to know is c++ or maybe java the programming language which is used by most programmers to write those software programs we seen on cnet or clickbank?[/QUOTE] It might be neither. Learn a little bit about the advantages of each language and choose the one that's … | |
![]() | Re: There's an invisible control character on line 33. Delete the line and rewrite it. ![]() |
Re: A pointer is not an array, it only plays one on television. You have to allocate memory to the pointer and then assign values, which for the purpose of this post we'll say you cannot do in a structure initialization list: [code] #include <iostream> #include <string> using namespace std; struct … | |
Re: 0x1A is the ASCII value for Ctrl+Z, which is the end-of-file character for a text stream on Windows. Since you're doing arbitrary seeking on the file anyway (an operation that's undefined for text mode streams), you can open the file as binary and that will fix the problem of 0x1A … | |
Re: [QUOTE]So, can you see what is wrong with the program?[/QUOTE] I'd wager that it has something to do with your math. You're using the size of the buffer rather than the number of extracted characters to calculate the seek offset. Compare and contrast: [code] char *a3_fgets_2(char *str, int num, int … | |
Re: [QUOTE]kbhit() is for any key but i want to modify it to a specific key ..[/QUOTE] kbhit() tells you if a key has been pressed. You can then use getch() to determine the value of the key. [QUOTE]i want to retrieve the x and y coordinates of of an object...how … | |
Re: IT would be helpful if you actually stated what the error was, but I suspect it's due to using [ICODE]bool[/ICODE] (as well as [ICODE]true[/ICODE] and [ICODE]false[/ICODE]) either in C90 mode or in C99 mode while failing to include <stdbool.h>. But please note that being able to spot that has nothing … | |
Re: It would probably be easier if you stored the times entirely as seconds and then converted to "<minutes>:<seconds>" for display purposes. I don't suspect that these times are likely to exceed the limits of one of the integer or floating-point types. | |
Re: Whitespace in the format string says "skip all whitespace". | |
Re: >I want to learn how to write a compiler. Okay, you need to know the language that the compiler processes inside and out, as well as assembly for all of the machines that the compiler will be run on (assuming you're compiling to machine code, it's easiest to output assembly … | |
Re: [QUOTE][CODE]to_bin(dec,size); //using same function again[/CODE][/QUOTE] Yes, you're using the same function again. This is a recursive call with no base case, which means your error is a stack overflow. Try casting the arguments into an exact match for the overloaded function if you want to reuse it: [code] to_bin(static_cast<unsigned int>(dec), … | |
Re: [QUOTE]can anyone please tell me whats actually happening in this code.[/QUOTE] I'd have trouble writing worse code intentionally. If you got that code from a book, my recommendation is to burn the book so as to protect other hapless beginners from reading it. The author is clearly incompetent. [QUOTE]I ran … | |
Re: [QUOTE]Some of my friends say it is useless to learn it, since there are no one would like to use it and you can't use it because there are no one know how to use it.[/QUOTE] There's some truth to that opinion. But avoiding the techniques doesn't make them any … | |
Re: You forgot to add a comma between the parent name and age values: [code] cmdtext = "insert into tblSTUDENT(FULLNAME, PARENTNAME, AGE) VALUES('" + txtStudentName.Text + "', '" + txtParentName.Text + "', " + txtAge.Text.ToString() +")"; [/code] Sometimes it helps to use string.Format() instead of concatenation because the formatting around placeholders … | |
Re: [QUOTE]But its not working[/QUOTE] Not helpful. [U]How[/U] is it not working? What did you expect versus what it currently does? | |
Re: You can find a simple random number generator in <cstdlib>. From there it's a simple matter of selecting N random values from a list of letters: [code] #include <cstdlib> #include <iostream> #include <string> int main() { std::string alphabet = "abcdefghijklmnopqrstuvwxyz"; for (int i = 0; i < 10; i++) std::cout … | |
Re: The = operator assigns while the == operator tests for equality. You're using the assignment operator for equality, and C's implicit equality rules apply. Here's an example of your code: [code] if (type = 1) bus[99] = "Single-decker"; else bus[99] = "Double-decker"; [/code] Here's how C is really interpreting it: … | |
Re: Could you post all of the code? The place where it's complaining isn't necessarily the source of the error. [QUOTE]Also wondering what this is: 1 D:\ANNAT\Dev-Cpp\include\c++\3.4.2\backward\iostream.h:31, from CRY\DICE.cpp In file included from D:/ANNAT/Dev-Cpp/include/c++/3.4.2/backward/iostream.h:31, from CRY/DICE.cpp[/QUOTE] GCC boilerplate in an error log. While it can be helpful, a lot of the … | |
Re: You'll want to read a full line, then break it down into columns with something like stringstream: [code] #include <fstream> #include <iostream> #include <sstream> #include <string> #include <vector> int main() { std::ifstream in("test.txt"); std::vector<std::vector<int> > v; if (in) { std::string line; while (std::getline(in, line)) { v.push_back(std::vector<int>()); // Break down the … | |
Re: [QUOTE][CODE]redblacktree<int> *r; r=rb.search(90);[/CODE][/QUOTE] It looks like exactly what the error states. rb.search() returns a pointer to T, not a pointer to redblacktree<T>. Since the code for redblacktree::search() really does return a pointer to redblacktree<T>, your member function signature is wrong. IT should be: [code] redblacktree<T>* search(T y) { ... } … | |
Re: What's more personalized than people answering your specific questions? | |
Re: >Programmers focus more on writing the code. Software engineers >focus on a larger picture...cost of making the program, cost for >consumers, consumer usability, efficiency, and management of >the overall project. I'm going to go ahead and disagree with you on that one. Sure, [i]bad[/i] programmers focus more on writing the … | |
Re: Unfortunately, Daniweb does not allow discussions about hacking, and cracking the security on archive files falls neatly under the definition we use for "hacking". Sorry. | |
Re: [QUOTE]Can someone help me or give me info?[/QUOTE] Open your book to the chapter on I/O and read it. If you don't understand how to read an integer from input, that's the first step. ![]() | |
Re: The compiler is right, D3DXMATRIX doesn't have a member named "m". However, D3DMATRIX does have such a member, which suggests you're not using the type you thought. | |
Re: The very definition of an abstract method in C# is a function declaration without an implementation. Non-abstract derived classes are required to provide the implementation. If you want to provide a default implementation, the method should be virtual rather than abstract. If you want to keep it abstract just replace … | |
Re: Try Accelerated C++ by Koenig and Moo. While it may also be too fast if Thinking in C++ is too fast, I'd rather not recommend some of the more accessible books unless absolutely necessary because quality tends to drop rather quickly as the pedagogy methods are simplified. | |
Re: Props for making an honest attempt at converting that Pascal program, but your translation is a bit lacking. Compare and contrast: [code] #include <stdio.h> void swap(int *a, int *b) { int temp = *a; *a = *b; *b = temp; } void tipareste(int a[], int n) { int i; for … | |
Re: [QUOTE]But where is the function body?[/QUOTE] In an object library somewhere, either statically or dynamically linked to your code when you build. Many libraries are linked for you by default, such as the standard C library and common POSIX libraries (which includes the things declared in sys/stat.h). Others will need … | |
Re: The only application for bubble sort is in the classroom. It's a simple algorithm, arguably the simplest sorting algorithm, and well suited as an introduction to the concept. However, it's hideously inefficient even compared to other quadratic sorting algorithms. | |
Re: [QUOTE]The main() function is not allowed to be called inside a program.[/QUOTE] You're thinking of C++. It's legal in C (though rarely a good idea). | |
Re: Your j index is out of bounds because the inner loop test is [ICODE]arr[j] <= num[/ICODE] rather than [ICODE]j <= num[/ICODE]. You want to test the index, not the value stored at that index. |
The End.