- Strength to Increase Rep
- +7
- Strength to Decrease Rep
- -1
- Upvotes Received
- 23
- Posts with Upvotes
- 20
- Upvoting Members
- 15
- Downvotes Received
- 6
- Posts with Downvotes
- 6
- Downvoting Members
- 4
118 Posted Topics
Re: If you have a sufficient version of microsoft visual studio you might be able to use the CImage class [URL="http://msdn.microsoft.com/en-us/library/d06f3fhw(VS.80).aspx"]http://msdn.microsoft.com/en-us/library/d06f3fhw(VS.80).aspx[/URL] however, express doesn't have this. Otherwise it is a messy procedure as there is more than one jpeg encoding you probably will need to read up on bitmap headers or … | |
Re: With template code you have to be careful on relying on the compiler. You can have broken code that the compiler does not complain about. Until you instantiate a class you cannot be sure that you have no conflicts. Your singleton method seems a little unusual to me it may … | |
Re: Hi i have only skimmed your code but there are a couple of things that stand out as potential problems 1: in remove number: with the first for loop you want the original size not `size -1`, otherwise, if you try to remove the last number in array it won't … | |
Re: It is windows games programming books and articles that probably have the cleanest explanations of what you want to know. There are ways to short cut building a window, depending on the version of visual studio you use. but it is worth knowing how to construct a window without any … | |
Re: I'm not sure what the problem is going to be explicitly, but you might want to try adding paint() on activate aswell as on paint itself. I remember having an issue with when the window was drawing with VIsta but went away when I used a different approach. You could … | |
Re: [QUOTE=jonymanolo;1191248]is posible expalin my for what use %s in a code line [CODE]cmdLine.Format("\"%s\" \"%s\" %d %s %s %s", playerFile, moviePath, 10, cameraName, selectDate, movieID);[/CODE] i need now how works this code line[/QUOTE] It is used as a placeholder to substitute values into the place of: so the first %s is … | |
Re: [QUOTE=rtllz;1181687]I'm confused as to where im supposed to put the the location of the file such as C:\\Documents and Settings\\user\\Desktop\\myfile ??[/QUOTE] you will need a file extension too. the double [icode]\\[/icode] are needed for the direct string input but if you [CODE] std::string location = "C:\\folder1\\folder2\\my_file.txt"; std::cout << location << … | |
Re: As salem stated you are asking for an input of a char which is a sinlge digit or letter. so this can only give one letter at a time however, you are also using a while loop so you are getting first [CODE] char digit; int count(0); while(cu != -1) … | |
Re: you are very close to getting ti working the problem is how you are converting an [icode]int[/icode] to [icode]char[/icode] assuming that you are only going from 0 to 9 you can have [CODE] //this is either the relative or absolute file path std::string base_file = "data"; std::string after_number = ".txt" … | |
Re: [QUOTE=yaoc1987;1181667]im calling this function from main bin_p.binary_print(outs, n); ^that is in int main() void binary_print(ostream& outs, unsigned int n); ^this is in the header file [CODE] void rec_fun::binary_print(ostream& outs, unsigned int n) { if(n < 2) { cout << n << endl; } else if(n >= 2) { binary_print(outs, n/2); … | |
Re: [QUOTE=KBL;1171492]KB.cpp(18) : error C2447: missing function header (old-style formal list?) [CODE] public: Password(void); [/code] [/quote] I would not expect to see [icode]void[/icode] void being used as a parameter [icode]()[/icode] is standard. but what I don't see is a definition of [CODE]Password::Password() { } [/CODE] and the compiler might be complaining … | |
Re: caveat: This code is doing lots of things that look messy. Especially for the error that you are unfamiliar. Your error means that you need the .h file or at the top with somting like [CODE]int GenerateRandomValue(int v1, int v2);[/CODE] You will also need the definition of the function at … | |
Re: Without seeing a full example, it seems odd behaviour. As a first thought, I assume that you are talking about opening a file that is acting as a database and you want to move to the first entry. you might try explicitly adding the [icode]ios::beg[/icode] [CODE]fbin.seekg(0, std::ios::beg);[/CODE] if this doesn't … | |
Re: [QUOTE=Afupi;1169435]Ok so after a few days, I finally got the 8 queens problem solved. After having so much trouble I decided to practice recursion by doing the same problem but with 32 knights. 8x8 board, place 32 knights without them attacking one another.[/QUOTE] A bit off topic so apologies :) … | |
Re: you have not got [icode]{}[/icode] matched in all places. The compiler won't give you a line number for this so if your code isn't too long and you still can't find the error post it. [QUOTE=stricklypni;1173753]I will show the code if you want to see the error.... Am still working … | |
Re: [QUOTE=Pynolathgeen;1171525]My program keeps crashing when not in debugging mode. So now i'm debugging manually, or well, log everything to find where it is crashing [code=C++] DirectX = new DIRECTX(); // Creating DirectX [/code] [/quote] is not calling : [QUOTE=Pynolathgeen;1171525] [code=C++] DIRECTX::DIRECTX(HWND Window) [/code] [/quote] but [CODE]DIRECTX::DIRECTX()[/CODE] so we can't see … | |
Re: > start quote: # include <stdio.h> abc (y++); // error here > end quote. This result surprised me too. I guess it is because y++ passes the variable into the function as y and then tries to further alter the variable after entering the function which adds potential undefined behaviour … | |
Re: Here is a sample header file: should have: 1- description to ensure that you understand your design 2 - meaningful class name the same as the .h file name you can have iterator classes in the same header 3 - function names that make sense 4- comments on how to … | |
Re: Main needs to cin [CODE] std::cout << "please enter operator" << std::endl; std::cin >> character; [/CODE] before [QUOTE=micmagicfly;1171541][code] switch (character) { case '+' : addition(); [/code][/QUOTE] | |
Re: You are not describing all of the details very thoroughly: [QUOTE=anugrah.agrawal;1168939]....i am well versed with the algorithm to do this... PLease help!!!![/QUOTE] I am assuming that you are using visual studio To read the input from a GUI - either write an application that is part of the GUI or … | |
Re: Without seeing your code it is a tricky question to answer. What you probably want to do is put both programs into classes then you can create an instance of the class and decide whether to run it on the if say a simplified version of your code looked like … | |
Re: [QUOTE=buckkitty;1169179]Hello, [code] double temp_data = NULL; //temporary matrix int u = 654; // u = the total number of periods in the time series [/code] bk[/QUOTE] There are some inconsistancies in your descriptions and implementation. If this isn't an assignment there are quicker ways to load the data. 1st this … | |
Re: const is a some what overrated concept that leads to more typing and maintenance. In your case myfunc is not const as it alters a member variable if this is not appropriate to be altered then you need to use a local [CODE] double myfunc(double x1,double x2, double x3) const … | |
Re: I have no tried playing around with this One approach is known as skinning or a skin This can change the style of how windows appear used to be popular for windows themes. Another approach is more re-writing the wheel where you use a window with no frame and redraw … | |
Re: !st template class will compile fine until the code is used. [icode]TreePath[/icode] is not defined in the code you have shown Path has some risky behaviour [QUOTE=o0mkh0o;1168737] [CODE] T& getLastPathComponent(void) const { return *lastPathComponent; } [/CODE][/quote] using a pointer that you do not own without any error checking is dangerous … | |
Re: I will try to be succinct: 1. a static member variable acts like a single common variable that is a global so there is only really one 'n' in the whole project 2. a constructor [icode]()[/icode]is called every time the computer has to allocate memory and give an address to … | |
Re: One approach is to treat all of your input as chars say using [icode]std::srting[/icode] [CODE] #include <string> #include <iostream> int main() [ std::string input; std::cout << "please enter data" << std::endl; std::cin >> input; //using an int instead of sizetype f //step over each char of input int sz = … | |
Re: I am rusty on this but as you say if hWind = 0 then you are using a method that requires a handle to a window if this is 0 it most likely means that you have not created a window successfully. So your new might not have created a … | |
Re: if you load the file [icode]#include <fstream>[/icode] read in the file using [icode]std::ifstream("folder\\file.txt"[/icode] now two options load into a single string or line by line. Single [icode]std::string[/icode] will be easiest there are google articles on how to do this The next thing is [code] std::string data; //load data //this is … | |
Re: you are asking sensible questions about how you would reverse the digits of a number. And the reason why you are having problems is that it is not defined behaviour - so to code it for non-integers requires a decision as to what is intended. Option one treat it as … | |
Re: If your [icode]string[/icode] is just a [icode]std::string[/icode] then your write methods are not taking advantage of the methods available to you [icode].c_str()[/icode] this converts a std::string into a char * and [icode].size()[/icode] gets you the length of a string therefore [code] std::ofstream fout("test.txt", std::ios::bin); if(fout.is_open()) { fout.write(str.c_str(), str.size()); fout.close(); } … | |
Re: At a glance it looks as if the .dll is being included twice possibly under different names as all the errors come from [icode]MSVCP90D.dll[/icode] I am not sure how best to stop it though... [QUOTE=Kosithc;1159562]Thanks for reply! Header files, which i include to my project, were provided with Alglib and … | |
Re: cout doesnt recognise arrays so you are outputting a pointer what you wanted to do is [CODE] #include <iostream> int main() { int list[12] = {8,1,11,4,2,9,10,5,3,12,6,7}; //can go faster but this is easiest to read for(int j =0 ; j < 12; ++j) { std::cout<<list[j] << " "; } //output … | |
Re: First glance it is [code] using namespace std; [/code] causes your compiler to find [icode]std::copy[/icode] instead of copy when it looks at copy | |
Re: Coming in late you have colours that you want to convert to different types and formats: This would normally be a single set of formulae for each conversion and would not require a convert but if you are pairing names with values and vice versa couldn't you just use maps … | |
Re: Just a minor point: php explode has a third optional parameter that limits the number of times to split [URL="http://www.tizag.com/phpT/php-string-explode.php"]http://www.tizag.com/phpT/php-string-explode.php[/URL] so [code] std::vector<std::string> php_explode(const std::string ÷, const std::string &to_explode, int max_number = -1); [/code] would be closer to the php_function signature but an easy modification to Nick's code | |
Re: your code appears to moving around a bit and Iwould make sure that everything is as safe as can be is pos an int? [CODE]ItemType *temp = new ItemType[pos];[/CODE] them new would fail with a -1; if so safer to have [CODE] if (pos == 1) { a[0] = key; … | |
Re: msdn is a good place to start : [URL=" http://msdn.microsoft.com/en-us/library/system.windows.forms.systeminformation_properties.aspx "]http ://msdn.microsoft.com/en-us/library/system.windows.forms.systeminformation_properties.aspx[/URL] I think this is probably the one you wanted your output from the functions could use [icode]std::string[/icode] and then output with [icode]#include <iostream>[/icode] & [icode]std::cout <<[/icode] or to a file some of your coding seems unnecessarily non standard … | |
Re: [QUOTE=abhimanipal;1158745]Hello Everybody, [code=c++] int operator()() { return n++; } [/code] [/QUOTE] yikes this is not a good idea to call a function without a name I don't think I have ever wanted to overwrite the [icode]operator()[/icode] this is overloading a constructor in a class, change the name or use [icode]operator++[/icode] … | |
Re: I probably should not jump into a thread where so many people have ready jumped in but here goes... You have a lot of posts but clearly there are somethings that have never quite grasped. First what you have to understand is what a rational number is: an integer is … | |
Re: I haven't gone through all your code yet, and there are some dangerous bits of code that are probably not currently causing an issue. If you have a function outside of a class it is best to pass in a variable to a function rather than access a global directly. … | |
Re: [QUOTE=rahulrulez;1158381] Here I need to use Graphics and mouse handling.. I'm totally new into Mouse programming in C++, still doing the coding with help of some online tutorials.. [/QUOTE] This is a question that seemed fairly easy to answer until I then looked at your code. I take it that … | |
Re: First when you encounter a problem you should break it down it to small chunks. Therefore start with some very simple data. is your code crashing or just not giving the output that you would expect? As a rule it is not a good idea to use [icode]ofstream[/icode] as a … | |
Re: Your [icode]if[/icode]s are going awry again use {} every [icode]if[/icode], [icode]else if[/icode] and [icode]else[/icode] and many of your problems vanish without them [icode]if[/icode] will only run until next [icode];[/icode] [code] if(x == 1) {//always use me x = 3; }//and me else {//here too x = 4l }//etc [/code] [QUOTE=aianne;1158383]Hi! … | |
Re: NetBeans are we talking Java... ? Most c++ code is platform independentant and linux implementations normally include use of codes that will work on both windows and linux, so this should be the end goal. That way the windows will be a bit harder but give you what you want … | |
Re: Your question highlights some gaps in your understanding in the statistics area. As phrased at the moment the answer is no it is not possible but perhaps you could be clearer. The data structure just contain data and are mathematically approximately just vectors [QUOTE=MyRedz;1158268] i was wondering. of all the … | |
Re: I am assume that the code that you have provided was a retype as it would not run. [icode]using namespace std;[/icode] is the minor issue the bigger concern is that your [icode]if[/icode] blocks are out of sync. I would recommend that you always nest your if blocks with [icode]{}[/icode] this … | |
Re: With operator overloading just think of it as a function. You need to decide: 1 - do you need this function now? 2 - what is an appropriate name for what it does 3 - how to write the function 4 - is this the correct place to have the … | |
Re: You want to read up about game engines and you will find that there are several options that would allow you to start very quickly. If you are using visual studio and windows the trickiest bit is creating the window and understanding what messages are about. Now although versions of … | |
Re: I assume that you are asking this question for a windows system which won't let you create a directory from [icode]fstream[/icode] so you need [CODE] #include <windows> int main() { std::string folder("C:\\my_folder"); CreateDirectory(folder.c_str(), NULL); return 0; } [/CODE] The Null is for the security settings which might let you lock … |
The End.