6,741 Posted Topics
Re: What do you mean by raw data? Querying the tables into a DataSet object is about as raw as it gets. | |
Re: Don't dereference file_test. It's already a pointer to FILE. | |
Re: [QUOTE]I really have no idea how to do it.[/QUOTE] Not paying attention in class, then? [QUOTE]But this is what I have done so far[/QUOTE] Which is to say nothing, because all of the member functions are empty. Writing the declarations doesn't really count as doing anything, much as I'd like … | |
Re: This is a new feature for voting on posts. Before there was no option to undo a vote, now the option you selected (either up or down) will be shown with an undo icon. By clicking that and refreshing the page, you can remove your previous vote. The idea is … | |
Re: There's no such feature in the stdio library. The best you can do is extract a character, then return it to the stream with [URL="http://www.cplusplus.com/reference/clibrary/cstdio/ungetc/"]ungetc[/URL], but that's probably sufficient for your needs. If you need to unget more than one character, some custom buffering will be required to retain portability. | |
Re: There are three issues: [B]>#include <iostream.h>[/B] Depending on the age of your compiler, this may or may not work. <iostream.h> has been replaced with <iostream> and all contents placed in the std namespace. [B]>main()[/B] C++ does not support implicit int. You must specify the return type of int. [B]>char std1[20], … | |
Re: [QUOTE]Can someone suggest from where to start.[/QUOTE] I'd start by creating a random connected graph (the simulation framework). Then you have the structure required to add a flooding algorithm. [QUOTE]I will use structs or classes?[/QUOTE] Probably a good idea for the nodes of the graph. [QUOTE]How the flow of the … | |
Re: [QUOTE]An array is a pointer (to the zero-th element)[/QUOTE] No, an array is not a pointer. An array name when used in value context will be converted to a pointer to the first element, but this conversion does not take place in an object context. You can verify that this … | |
Re: I'm not sure I understand the question. Do you know how to write to a file? | |
Re: [QUOTE]error C2664: '_stricmp' : cannot convert parameter 1 from 'WCHAR [260]' to 'const char *'[/QUOTE] That's a perfectly rational error. Your string is of type WCHAR and _stricmp clearly only accepts strings of char. On the assumption that you're using a compiler which supports it, try _wcsicmp instead of _stricmp. | |
Re: Create an index at both ends of the string and swap characters, moving the indices closer until they meet. When they meet (or pass), the string will be completely reversed. | |
Re: Please post a complete program that exhibits the problem. | |
Re: [QUOTE]A friend of mine just informed me that VS 2010 removed the feature where VS keeps the cmd window open when you start w/o debugging.[/QUOTE] Your friend is incorrect, though it's no longer a default setting. You can go to the project properties, Configuration -> Linker -> System, and set … | |
Re: [QUOTE]when i typecasted the base object to derived then pointer should call the fun() of derived (from virtual function call mechanism )[/QUOTE] When working with polymorphism there are two types in action: [list] [*][B]Actual Type[/B]: The type of the object itself [*][B]Virtual Type[/B]: The type of the pointer or reference … | |
Re: I think you're expecting us to be psychic. Can you provide a little context here instead of starting somewhere in the middle? | |
Re: It's functionally equivalent to [ICODE]sum = sum + c[/ICODE]. | |
Re: It's the [URL="http://en.wikipedia.org/wiki/C_preprocessor#Token_concatenation"]concatenation[/URL] operator. | |
Re: [QUOTE]so far I seem to understand how they work "I think" at this stage[/QUOTE] I think you're still fuzzy on the distinction between data structures and classes. It helps to think of data structures as more of an abstract concept while classes are a concrete implementation detail. A data structure … | |
Re: For each line you re-open the outfile in ios::out mode. This will always overwrite the file starting at position 0. Try opening outfile once before the loop: [code] ofstream outfile(file1); while (infile.getline(line,200)) { line[0] = toupper(line[0]); outfile<< line <<'\n'; } [/code] Note that using eof() as a loop condition is … | |
Re: Everyone has a different opinion. Though I haven't heard much advocacy of C over C++ for "fast" programs. Usually C is viewed as the obsolete parent of C++. [QUOTE]Heard people say c# for big programs, c for fast programs[/QUOTE] Big programs cannot be fast? [QUOTE]c++ is just something that failed … | |
Re: [QUOTE]No copy constructor is called. Whereas it should be.[/QUOTE] Actually, it shouldn't be. You're trying to use the copy assignment operator, not the copy constructor. A use of the copy constructor would be [iCODE]mymatrix c3 = c1 + c2;[/iCODE]. Generally, if you need a copy constructor, you also need a … | |
Re: I think you're over-complicating this. Though it would help if you could be more specific about [i]how[/i] data1 and data2 would be related. What kind of data are we working with? The choice of how to work with it does depend somewhat on how it's being used. | |
Re: 1985 is calling, they want their code back. I'm not surprised if you're using a modern compiler and getting warnings about K&R style C. | |
Re: [QUOTE]does anyone know at what posting number it changes to the next title, and/or what all of the titles are?[/QUOTE] Yes, and yes. But half the fun is seeing what comes next as you continue to post. :) | |
Re: [QUOTE]I am looking for something to compact the clear and push_back in one line...[/QUOTE] Why? [QUOTE]Any sugestion or idea?[/QUOTE] Nothing built into std::vector presently supports this. You'd have to add at least one line to get rid of one line, which nets you nothing. | |
Re: Your SSBL constructor is creating a new local Telegram object called tele that hides the private member called tele. So you're not actually initializing the private member at all. | |
Re: I notice your source file is called mule.c. Most likely your compiler is automatically detecting the desired language from the source file extension, which means you're not compiling as C++ but as C. C doesn't support the <iostream> header. Try forcing the compiler to compile as C++, or change the … | |
Re: In my opinion, typed datasets cause more trouble than they're worth. | |
Re: [QUOTE]Because this constant data ("asd", "QWE", etc.) is stored in a special read-only section in memory you are getting a segmentation fault.[/QUOTE] Just a clarification: String literals [i]may[/i] be stored in read-only memory. Borland compilers in particular have historically allowed modification of string literals due to not storing the string … | |
| |
Re: Sure, just store the previous value somewhere and assign it to p when you want to go back. | |
Re: Preprocessor macros must be all on one line. You'll typically see multi-line macros extend the line by using the \ character: [code] #define PUSH(s,c) \ if(push_char(s,c) == ERROR){ \ printf("Fatal error in pushing symbol on stack.\n") ; \ exit(1) ; \ } [/code] | |
Re: Compare and contrast: [code] #include <iostream> #include <fstream> #include <time.h> #include <stdio.h> using namespace std; tm *gettime() { time_t rawtime; time(&rawtime); return localtime(&rawtime); } int main() { cout<< asctime(gettime()); } [/code] | |
Re: [QUOTE]When i run it, it throws exception and says "object reference not set to an instance of an object" what could be the problem?[/QUOTE] I suspect you have an object reference not set to an instance of an object. :icon_rolleyes: The error is very specific; you need to look for … | |
Re: You can break a number down with division and remainder: 123 % 10 = 3 123 / 10 = 12 These two operations will allow you to test both digits. | |
Re: [QUOTE]Is it true that IDE/compilers will automatically include some things?[/QUOTE] It's possible, yes. [QUOTE]If yes, is there a compiler for windows that won't?[/QUOTE] The proper solution is to know exactly what you're using and explicitly include the correct header. If you're expecting the compiler to catch every error, you'll be … | |
Re: [QUOTE]All the results does not match up with my understanding of C.[/QUOTE] This is because you haven't yet learned the sequence point rule concerning modifications. The rule states that an object may be modified at most one time between sequence points, otherwise the result is undefined behavior. The + operator … | |
Re: If your linked list is a class and you've written a proper destructor, the list should be destroyed correctly. | |
Re: [QUOTE]But if i use a non-integer position counter[/QUOTE] I fail to see how your requirement leads to needing a non-integer index. | |
Re: This would be a good fit for strtok, if you're not locked into sscanf for any reason: [code] #include <stdio.h> #include <string.h> int main(void) { FILE *in = fopen("test.txt", "r"); char line[BUFSIZ]; if (in != NULL) { while (fgets(line, sizeof line, in) != NULL) { char *tok = strtok(line, ","); … | |
Re: You'd still have to put it in a loop: [code] #include <ios> #include <iostream> #include <limits> using namespace std; int main() { bool done = false; int number; while (!done) { try { cout<<"Enter a number: "; if (!(cin>> number)) throw -1; done = true; } catch (int) { cerr<<"Invalid … | |
Re: Make sure that dgvReservartion.Rows[a].IsNewRow isn't true. If your data grid view allows users to enter new rows directly, that last row with the * tends to be problematic. | |
Re: Post your full code. If it's too long, pare it down into something complete, but with all of the relevant parts. Trying to troubleshoot with tiny snippets is frustrating. | |
Re: How does CheckMemUsage work? It could be you're expecting the memory management to be handled in a different way than reality. | |
Re: Read an int, then ignore a single character. Optionally peek to see if the character is a comma for more robust error checking: [code] for (int i = 0; i < 2; i++) { for (int j = 0; j < 4; j++) { if (!(in>> a[i][j])) break; in.ignore(); } … | |
Re: squareRoot is not declared before it's used. Either move the definition above main, or add a prototype: [code] #include <iostream> #include "ArithmeticHeader.h" using namespace std; int squareRoot(int number); int main() { [/code] | |
Re: You can't initialize an array member in the initialization list. It has to be done in the body of your constructor. If you're creating an array of a user-defined type, that type must also support default construction. | |
Re: [QUOTE]Many old c++ compilers use now-deprecated iostream.h[/QUOTE] For the record, deprecated means that something is in the C++ standard but not recommended because it might be removed in future revisions. iostream.h wasn't, and isn't, part of the standard at all. [QUOTE]error: iostream: No such file or directory error: expected '=', … | |
Re: [QUOTE]But it is now slower! Why?[/QUOTE] At this granularity, it's probably system noise. Have you nailed down performance requirements, profiled your code, and determined that what you have is presently too slow? | |
Re: If you're just trying to display the result, something like this would work: [code] $ cat /dev/random | od -tl -w4 [/code] Remember that /dev/random is just a file. You can process it like any other file. |
The End.