2,045 Posted Topics
Re: t=0 should be t==0 (the first assigns 0 to t, the second checks for equality), etc., but in this case since t is a double, it is tough to compare with 0 or 1, etc, due to the inexact representation of doubles. What does your data file look like? | |
![]() | Re: [quote]how to passs strutre to an arry[/quote] Aside from having to strain my eyes to read that, what do you mean? How to make an array of structs? |
Re: What is the range of numbers in your data set? Make an array the size of your largest element. If you have 0-9, make an array of ints,"counts", that is size 10, and initialize each element to 0. If you encounter a number, increment that digits place in the array … | |
Re: Read in the lines one by one and write out the ones you want to keep into a new file. Please post what you have tried so far. | |
Re: I don't have any insights into your problem, but I'm curious about something. Doesn't the compiler complain on line 14 that lwFile isn't a [icode] const char *[/icode]? Normally the fstream objects take a C-string (so you'd need [icode] lwFile.c_str() [/icode] in that spot instead). | |
Re: #include <cstdio> which is the C++ version of the stdio.h header. | |
Re: [quote=Zjarek]In minus one day you can get negative day, and in function toname you only treat properly positive idx.[/quote] He's exactly right. What happens when idx is negative, your method toName runs right off of the end. At the end of toName, put something like [icode] return "junk"; [/icode]. You'll … | |
Re: @OP I think they've only been answered occasionally, but people have posted Obj-C questions in both C and C++. So, there are higher traffic forums, besides MD, for posts about that topic. | |
Re: There is a Python forum, I've flagged this to be moved there. | |
Re: That's a very long piece of code to ask someone to go through. Try to narrow down a specific region where you think the problem is occurring (you have your loop with the menu at the top, try to figure out why control is not reaching that point again). Try … | |
Re: [quote=??]you can use the /t and /n in your output [/quote] I believe he means '\t' (for tab) and '\n' Go with what Moschops recommends (a related command is found [url]http://www.cplusplus.com/reference/iostream/manipulators/setw/[/url]) | |
Re: See this article: [url]http://www.codeproject.com/KB/exchange/Exchange2007EWS-Part1.aspx[/url]. I think you should be able to add the dll as a reference in C++/CLI and just adopt the syntax. | |
Re: You're going to have to create a class that inherits from ListView and play with the underlying mechanics to get it to do what you want. Here's an example of doing it in VB ([url]http://www.vbforums.com/archive/index.php/t-145805.html[/url] I know it's the wrong language, but that value that they cite is probably what … | |
Re: Remove the =0.03 from the declaration (line 11). balance is a parameter of enterAccountData(), so it goes out of scope once that method ends. Use accountBal in computeInterest() instead. | |
Re: A variable in a local scope with the same name as a global variable overshadows that variable. cows in farm1 is incremented locally but then destroyed when the function finishes. Try removing line 5 and see what happens. P.S. It's considered a bad habit to use global variables (except in … | |
Re: Use ignore with no arguments, which will default to skipping 1 '\n' (you don't want the space like you have it) | |
Re: Just use the other version of getline: [code] getline(*streamReader,headerInfo); [/code] [quote]string is simply a char array correct?[/quote] I'm not an expert on this sort of thing, but I think the std::string class code could be implementation dependent, so I don't know to what extent you can rely on it being … | |
Re: Try changing line 3 to [icode] ClientResolution = Screen::GetBounds(this->ClientRectangle); [/icode] You need to give GetBounds a rectangle or a control so it can give you back the resolution of the screen showing that object, so give it the rectangle of the form. | |
Re: I've remained reticent on this issue because I have dealt with the original poster in the past. He knows I that became the most irate when he banged out a solution to a problem and pasted it into the box, usually leaving no explanation. He underestimates the fact that any … | |
| |
Re: ToolStripMenuItem has a "Tag" property (I think all of the controls do) which you could use to store the URL. Rather than generating an event handler for each new URL, make a generic one that navigates to the URL in the tag. What is the nature of the error when … | |
Re: What are some of your thoughts, then someone can either confirm them or make corrections. | |
Re: Do you have a line like [icode] cin >> somevariable;[/icode] up above that point? There's probably a stray newline left in the stream from where you pressed enter during the cin operation. [code] int i; string str; cin >> i; //enter in 10 + <enter>, 10 goes into i getline(cin,str); … | |
Re: You want a function like strcat instead of strcpy in that case (the M$ "safe" equivalent is [url]http://msdn.microsoft.com/en-us/library/d45bbxx4(v=vs.80).aspx[/url] strcat_s. strcpy by nature just clobbers whatever is there. | |
Re: Even though it may not be related to what you are changing, I'm going to assume it is: voting/rep system doesn't seem to be working in C or C++. | |
Re: Try out the Mark Summerfield free one ([url]http://www.qtrac.eu/marksummerfield.html[/url], Qt4 version, first edition). It's not bad. The first few chapters he takes you through creating a "spreadsheet" application. That part may be too basic for your needs, but he then goes through the rest of the library (including all of the … | |
Re: What are you expecting it to print? Can you narrow it down to a small section that's not working? | |
Re: [QUOTE=adn295]hi i think you have overloaded ">>" operator so that compiler gets confused about which operator should be matched exactly with that operand since >> is a built in operator so you should not overload it. Hope this will clear your confusion...[/QUOTE] Wait, what? The issue is that your prototype … | |
Re: Please post what you have thusfar and indicate some specific areas in which you require the most help. | |
Re: Look into .NET Reflector (a legal program that has a free version). It's normally used for C# and VB, but there seem to be some add-ins for C++/CLI that are out there (I've never used any of them, so I can't attest to their validity). You're probably better off trying … | |
Re: Have one of the files from the project selected, then under Project/Properties/Run-Debug Settings/Launch Configurations for '<yourproject>' select your exe file (so probably needs to be built before editing this, but I don't know). Then edit and select the arguments tab. | |
Re: I think the function you are looking for is fread (the parameters are in a slightly different order, see [url]http://www.cplusplus.com/reference/clibrary/cstdio/fread/[/url]). AFAIK, read is an iostreams method from C++. | |
Re: Do you have [icode]using namespace System::Net;[/icode] at the top? | |
Re: [quote]But I have recieved any answe yet .[/quote] Be patient, this is something that is going to have to be looked into by a moderator. One may not be available presently. | |
Re: When passing in a 2D array you must specify the second dimension in the parameter: [icode] void PrintArray(int array[][2],int n);[/icode] I should point out that the size of a fixed sized array must be known at compile time, so what you are relying on is likely a compiler extension and … | |
Re: If you're going to instantiate your array outside of one of the methods (Load, Click, etc.) it must be static. The constructor of the form is a good place to instantiate it, but leave the declaration of it right where it is. I've heard (though I've yet to get my … | |
Re: Whew, it took me a while, but I think I've got it. Your turn. (at least post what you have so far so someone can help you with your code) | |
![]() | Re: There may be some non-standard functions to do so in TC++, but I would just try to open it using an fstream object then use the .is_open() method to make sure that it has opened successfully. That's kind of quick and dirty, as I'm sure there are different OS dependent … ![]() |
Re: You can also call [icode] Invalidate();[/icode] anywhere within your code to force the Paint() method to run. | |
Re: [icode]comboBox1->SelectedIndex[/icode] will give you the zero-based index of the item you've selected. Probably you were just in a rush, but you want the == instead of = in your line of code above. | |
Re: It would be nice to know what the error was that you are running into. The formatting on this code is terrible. Give [url]http://www.gidnetwork.com/b-38.html[/url] a read. | |
Re: Use a debugger (or pepper it with cout statements) to see how far it gets in execution. If you can't find it after that, post back and I'll compile it. | |
Re: Which one do you actually want, this C++ version (which isn't in the right spot anyway) or the other C version? It's very confusing when things are posted that way. | |
Re: [quote]Need a standard fifo algorithm[/quote] A std::queue would be a good abstraction to look into. I'm not sure how it's actually done, but you could probably look into dissecting the one that the Linux kernel uses. | |
Re: You probably don't need an array of strings. Just make a function that takes two strings as parameters. [icode] void isPalindrome(char * str1,char * str2) { }[/icode] Use the length of one to step backwards through that string while doing forwards through the other one. | |
Re: What are you trying to print out with "DayOfTheWeek.getDay"? That call would only work if getDay were a static member variable of DayOfTheWeek. Which line is the compiler referring to with the second error message? | |
![]() | Re: I would learn to use arrays first, then functions. You can consolidate all of your tickets down to an array of characters (or eventually a std::string when you learn more about those). |
Re: I don't think I can say anything "constructive" here, but just imagine what I could have said. And thank you, I know. | |
Re: I think you are confused, [icode] string str[100] [/icode] is giving you an array of 100 std::strings. Is that what you want? Bear in mind that characters are just 1-byte ints, so they can be added to or subtracted from: [code] char c = 'a'; c++; std::cout<<c<<std::endl; //'b' c+=2; std::cout<<c<<std::endl;//'d' … |
The End.