1,174 Posted Topics
Re: [QUOTE=jdpjtp910;1127095] Since the record was not edited by the program why did the price and quanitity change? [/QUOTE] In the [ICODE]displayRecord()[/ICODE] there is an extra [ICODE]inventory.read(...)[/ICODE] at the start of the function. So the position is hence off by one. And then a little error where the address of operator … | |
Re: error: cannot convert ‘std::string’ to ‘const char*’ for argument ‘2’ to ‘int mysql_query(MYSQL*, const char*)' That says that you cannot pass a [ICODE]std::string[/ICODE] to the mysql_query(). Since it expects a [ICODE]const char *[/ICODE], you need to use the [ICODE].c_str()[/ICODE] method, so simply change to; [CODE]mysql_query(conn, queryText.c_str());[/CODE] | |
Re: There is a very basic problem that you have in main(). Now if you go through it carefully, you'll notice that there are [ICODE]float Mean[/ICODE] and [ICODE]float MeanValue[/ICODE] trying to serve the same purpose. | |
Re: A few quick notices, 1) These two are declared and used, but not implemented bool operator==(const matrix &); bool operator!=(const matrix &); The code should not actually compile because of that, isn't your compiler saying anything? 2) There is no copy constructor i.e. [ICODE]matrix(const matrix &)[/ICODE], you absolutely need one, … | |
Re: [QUOTE=tetron;1122182]I appear to have hit a memory limit in visual studio.[/QUOTE] Since you are trying to allocate rather huge amounts of memory (2GB), I'd guess that the limitations are more probably imposed by your operating system (which one is it?) than the std::string implementation. See MSDN documentation on [URL="http://msdn.microsoft.com/en-us/library/aa366778(VS.85).aspx"]Memory and … | |
Re: [QUOTE=smith73;1123753]Please explain what you mean by Tag before you post, this is my first time so I have no clue in what Im doing today.... LOL[/QUOTE] Well, adnan.siddique tried to say that use [I]code tags[/I] when you post code. That will preserve the code formatting making it readable. As you … | |
Re: [QUOTE=Nicholas_Roge;1123133]I've changed LoadLibrary((LPCTSTR)("test.dll")) to LoadLibrary((LPCTSTR)("C:/Users/Nicholas Roge/Desktop/test/test.dll")), however there isn't any luck. Unless I misunderstood what you were telling me to try, however.[/QUOTE] Have you UNICODE defined? If so, then the following cast[COLOR="Red"][/COLOR] [code] LoadLibrary([COLOR="Red"](LPCTSTR)[/COLOR]("test.dll")) [/code] causes this behaviour. The end result is that a non-UNICODE string gets passed to LoadLibrary[B]W[/B]() … | |
Re: The declaration of [ICODE]class CBaseAnimating[/ICODE] is missing a semicolon. | |
Re: [QUOTE=n.utiu;1098424]Dev is quite a good compiler and editor but IMO the debugger...sucks.[/QUOTE] In that case you might want to try out VC++ 2008 Express. | |
Re: This should do .. [code] public ref class DoubleBufferPanel : public Panel { public: DoubleBufferPanel(void) { this->SetStyle(ControlStyles::DoubleBuffer | ControlStyles::UserPaint | ControlStyles::AllPaintingInWmPaint, true); this->SetStyle(ControlStyles::DoubleBuffer, true); this->UpdateStyles(); } }; [/code] | |
Re: [QUOTE=miteigi-san;1121801]the program seems to ignore the getline part? why doesnt it work?[/QUOTE] I'd suspect that [ICODE]openWP.seekg(20*wordnum, ios::beg)[/ICODE] causes that to happen. If you seek to a position that's out of range, then [ICODE]getline()[/ICODE] will fail. You can see it for yourself by adding some output, for example [code] // snip … | |
Re: [QUOTE=Dizzzy;1121151][CODE]warning: format %d expects type int, but argument 3 has type __off_t[/CODE][/QUOTE] Change [ICODE]%d[/ICODE] to [ICODE]%ld[/ICODE]. That'll most probably fix it, [ICODE]%ld[/ICODE] tells that the argument will be [ICODE]long int[/ICODE]. If the warning persists, post back. [EDIT] Badly beaten by AD it seems, though I'm still in favour of trying … | |
Re: Aren't you doing something illegal at line 25 ? | |
Re: You have to move the [ICODE]int Banger::objectCount=0;[/ICODE] to the the banger.cpp file. | |
Re: [QUOTE=lsandling;1118344]I guess I am really having trouble with what's inside the function [B]How do I get it out[/B]..[/QUOTE] You get it out by passing it in in the first place. So for example [CODE] struct theThing { int ThingYesNo; double ThingHeight; // zero-initialize the member variables theThing() : ThingYesNo(0), ThingHeight(0) … | |
Re: [QUOTE=Roger_Hades;1118733] i have trouble trying to display the name of the contacts. p->first.get() [/QUOTE] What is the error message your compiler is giving? | |
Re: [QUOTE=phoenix69;613791]I tried many times but all in vain. Error...error.. and not even compiled.[/QUOTE] One practical approach, to get you started, would be to post the code that is not compiling (along with the error message(s)). | |
Re: Since it is a null pointer assignment, you might be able to start finding out the cause(s) of the crash using [ICODE]assert()[/ICODE]. So, for all your pointers wherever used, do: [ICODE]assert( the_pointer != NULL );[/ICODE] Likewise, add sanity checks, so that you will not allocate zero-length strings, i.e. [ICODE]assert( size_to_alloc … | |
Re: How is the [ICODE]fileName[/ICODE] actually declared? | |
Re: Just pass the vector by reference, so you will have [code] int solveMaze(int x,int y,vector< vector<char> > & maze,int size); [/code] | |
Re: [QUOTE=abhimanipal;1115002]Why does scanf("%d %d"+2) become scanf("%d") ?[/QUOTE] Would the following be of any help? [code]#include <stdio.h> int main(void) { char const * p = "invisible text" + 10; printf("%s", p); return 0; }[/code] | |
Re: You can also simply delete the line 32, [ICODE]otwarte_okna[/ICODE] gets constructed via the [ICODE]ListaOkien[/ICODE] default constructor automatically. | |
Re: [QUOTE=Roger_Hades;1115472][code] bool sortByName(tropical &t1, tropical &t2); sort (fruitlist.begin(), fruitlist.end(), sortByName); //problem!! gives me rubbish errors when compiled. could it be compiler problem?? [/code] [/QUOTE] GCC 4.4.0 says; [ICODE]stl_algo.h:124: error: invalid initialization of reference of type 'tropical&' from expression of type 'const tropical'[/ICODE] meaning that you need to change to: [code]bool … | |
Re: If it is CString as in MFC, then CString has methods like, Find(), FindOneOf(), Left(), Right() and Mid(). | |
Re: [QUOTE=phpangel;1109818]tell me where exactly i should declare the identifier "i"[/QUOTE] If you look at the compiler error message, it includes the file and also the line number where the error occurs, for example, given an error message like: foobar.cpp(10) : error C2065: 'i' : undeclared identifier you should open foobar.cpp … | |
Re: [QUOTE=sexyzebra19;1113432] however the cin doesn't seem to be working - I'm getting the initialised value of 0 for n no matter what I enter.[/QUOTE] That's because you are passing n by value. You need to pass it by reference instead, i.e. [code] double gauss(fun f, double a, double b, int … | |
Re: [QUOTE=sexyzebra19;1112353] what I have done wrong?[/QUOTE] To point out basic errors, see the comments below [code]#include<iostream> #include<vector> #include<cmath> #include<iomanip> using namespace std; class tabledata { private: long double abscisass[28]; long double weights[28]; public: void set_values(); } // a global variable here, will you be using it? If not, delete it. … | |
Re: A basic tutorial that might come in handy is [URL="http://www.winprog.org/tutorial/"]theForger's Win32 API Programming Tutorial[/URL]. | |
Re: [QUOTE=hammerhead;592457]Okay here is the pseudo code for hcf, credit to Euclid.[/QUOTE] Umm, I think I got the hcf part of it (thanks hammerhead), but how to figure out 'lcm of 2 nos' just beats me :-/ ... | |
Re: That's good to hear. But after all, maybe it still would be better to put the game aside for some time, and learn how to use functions/structures instead. What do you think? This is just to say that don't overdo yourself with a single function consisting of several hundreds of … | |
Re: [QUOTE=Grn Xtrm;1111738]I missed the brackets for the check array in the if statement. [/QUOTE] There is more than just the brackets here, i.e. [code] // not [COLOR="Red"]"[/COLOR]\n[COLOR="Red"]"[/COLOR], but instead ... if ( check[0] != '\n' ) [/code] | |
Re: Since you are not seeing [ICODE]MessageBox("INCORRECT"); [/ICODE] it's apparent that [ICODE]if(s == correct)[/ICODE] always evaluates to true (assuming that [ICODE]CI2T::IsCorrect()[/ICODE] gets called). Have you tried debugging? Put breakpoints at proper places, so that you'll be able to trace how [ICODE]s[/ICODE] is getting its value (and [ICODE]correct[/ICODE] too, unless it's a … | |
Re: You haven't told whether your [I]program[/I] is 32 or 64-bit. Anyway, did you try [URL="http://msdn.microsoft.com/en-us/library/ms724340%28VS.85%29.aspx"]GetNativeSystemInfo()[/URL] ? | |
Re: Just a suggestion, how about first primarily focusing on coding well-working basic routines (i.e. sorting, searching in this case), without them being 'slightly modified' for any specific purpose. Hence you would have something solid to further build upon. In other words, you would have a sorted array of strings, and … | |
Re: [QUOTE=freeseif;1108401] NOTE: [icode] ب = 0x0628 = "\u0628" [/icode][/QUOTE] 0x0628 is not UTF-8, but rather UTF-16. Dave Sinkula's [ICODE]0xD8 0xA8[/ICODE] is the UTF-8 representation of \u0628. | |
Re: :icon_eek: There are no checks against failed memory allocations. | |
Re: [QUOTE=Japus;1107299] I'm trying to use taglib in my Qt-program but it won't work. With this code, it doesn't compile <snip> What's wrong? [/QUOTE] Difficult to say, maybe even your compiler is faulty. In this kind of cases, rather post the actual compiler error message(s) along with the offending piece of … | |
Re: [QUOTE=iou;1106196] So does anyone know how to make use of getline() for this?[/QUOTE] You were on the right track (i.e. [URL="http://www.cplusplus.com/reference/string/getline/"]getline()[/URL]) in the beginning, so you might get the input doing e.g. the following: [CODE]#include <iostream> #include <string> using std::string; using std::getline; using std::cin; using std::cout; int main() { string … | |
Re: [QUOTE=Agni;1105345]Thanks Dave, I tried -pedantic option and it is still only giving a warning to me. Shouldn't it be a nice and proper error? [/QUOTE] Maybe try [ICODE]-pedantic-errors[/ICODE] | |
Re: [QUOTE=gedas;1105055]thank you very much your reply and for your solution i was trying to do it completely differently here is the code [CODE] // read the file from comand line and displys it #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> main(int … | |
Re: You need to tell the compiler what to do by specifying files/options on the command line. Clicking on the compiler executable will not do much as you've already noticed. Perhaps read a basic [URL="http://www.learncpp.com/"]tutorial[/URL], I'd suggest you to go through sections; 0.4 Introduction to development 0.5 Installing an Integrated Development … | |
Re: [QUOTE=Ultratermi;1103695] I cant find the same with System^String in WinForms... [/QUOTE] See e.g. [URL="http://msdn.microsoft.com/en-us/library/k8b1470s.aspx"]String::IndexOf Method (String)[/URL] | |
Re: I'm suspecting that you are unnecessarily trying to convert data back and forth (being somewhat unfamiliar with c++). So, if you'd describe in detail what you need to do, someone here might suggest a simple solution. | |
Re: [QUOTE=froggy1976;1103642]I would like to put the string day[7]; as private since the days of the week will never change [/QUOTE] Given the above code, you might have the [ICODE]string day[7][/ICODE] as a private member variable. So you must be doing something illegal in the code that you did not post. … | |
Re: [QUOTE=niek_e;1103000]Here's a start: [code] #include <iostream> int main () { std::cout << "welcome to my program"; return 0; }[/code][/QUOTE] Sorry niek_e, but that's not actually useful since the OP is to write a [I]C program[/I] (according to the instructions given) ;) | |
Re: That sounds like something rather complicated. One thing I can say though is that if you are using [ICODE]WM_SETFOCUS/SetFocus()[/ICODE] within that dialog box, then just don't. Those are not meant to be used with dialog boxes. Rather use [ICODE]CDialog::GotoDlgCtrl()[/ICODE] or [ICODE]WM_NEXTDLGCTL[/ICODE] to set the focus. | |
Re: [QUOTE=sisse56;1102028] how can I solve the problem [/QUOTE] Start off by reading the many answers you've already gotten so many times. If you don't understand a specific piece of advice, then ask for more details about that specific case. (I assume using English is not the problem for you here … | |
Re: [QUOTE=k1_zav;1101951]But the codes works properly when G=280 and l=3...[/QUOTE] Since you are unwilling to post any code, I guess that you have this [CODE]const int G=290; const int L=3; float ReplicatedMat[G+1][L];[/CODE] inside a recursive function eventually causing the stack overflow. [EDIT] Perhaps run the program in the debugger and at … | |
Re: Have you tried the following ? [CODE]// WM_INITDIALOG handler of your property sheet class // (derived from CPropertySheet) BOOL CMyPropertySheet::OnInitDialog() { BOOL bResult = CPropertySheet::OnInitDialog(); // Hide the Cancel button GetDlgItem(IDCANCEL)->ShowWindow(FALSE); // Disable the OK button GetDlgItem(IDOK)->EnableWindow(FALSE); return bResult; }[/CODE] |
The End.