2,045 Posted Topics
Re: Use an array of ints that's 26 elements long. Use arithmetic to transform the letter you are reading into an index of that array (where 'A' corresponds to element 0 of the array). | |
Re: Using "register" is virtually pointless these days because those good folks that write compilers already have tons of optimizations that are working in your favor. I'm sure that someone who has a more intimate relationship with compilers can flesh that out a bit for you. If you've never explored templates … | |
Re: I believe the switch is "-E" to preprocess but not compile. | |
Re: I found [url]http://www.qtcentre.org/archive/index.php/t-3604.html[/url] but I don't know if that gets you any further ahead than before. I had thought it might have had to do with your initializer list on the constructor on line 3 of the second listing. | |
Re: Am I correct in assuming you're doing a Windows Forms application? The textBox has a Focused method ([url]http://msdn.microsoft.com/en-us/library/system.windows.forms.control.focused(v=VS.100).aspx[/url] , for the latest incarnation, but it goes back to .NET 1.1). [quote]It can't be a cursor[/quote] It is still referred to as a cursor, as it was called that long before … | |
Re: Never done it, but it sounds tractable: [url]http://weblogs.asp.net/twalters/archive/2003/12/29/46265.aspx[/url] | |
Re: I think the short answer is, in that case, no. The ifs call returns a pointer to an ifstream object, not the value read in from the file -- this allows you to chain calls like `ifs >> x >> y >> z;`, where y and z are two other … | |
Re: I agree wholeheartedly with WaltP's sentiment. However, because I'm feeling generous around the holidays (and because this didn't come up on the Google search) try [url]http://www.winprog.org/tutorial/[/url] if you are interested in the Win32 API. | |
![]() | Re: I'm assuming you selected a CLR/Winforms application in VC++. If you want to make a standard C++ program select Win32 Console Application instead. The CLR implementation of C++ (C++/CLI) relies on the .NET libraries and a slightly different syntax (as you're finding with the "ref class" keyword. There are a … ![]() |
Re: My money's on the fact that your arrays are of different size (you're probably walking off the end of answer1 and answer3). This is impossible to tell without more context. Also, I wasn't sure you needed help from your thread title. (meaning, we get the idea, and you're less likely … | |
Re: Download DOSBox and try running it under that. Otherwise, use it under XP. You're trying to push a plow with a high speed train. ![]() | |
Re: Why not make some arrays of Card objects? You could have 3 arrays (or lists or vectors, etc.), one for the deck, one for the hand of the player, and one for the active meld. I know you've done some work on this already, so those are just suggestions. | |
I don't know if it's possible to add a feature to do this, but it would be nice to know when a post prior to yours in the thread has been edited. I'm more prone to look for it, but when I'm on a thread with someone new to the … | |
Re: Under Project/Properties/ConfigurationProperties/Debugging/CommandArguments | |
Re: [quote]char name; is the same as char name[1]; [/quote] I'm not so sure that's necessarily true, as the first doesn't involve a pointer and the second does. (I welcome opposing viewpoints) | |
Re: Okay, I did it. Now it's your turn. You need to make an attempt before someone can help you with your code. EDIT: beaten by myk, but you get the idea. | |
Re: Declare video2 as a private member variable of Form1. | |
Re: [code] ReadList(Array[], N); Avgs (Array[], b, Ave, AveP, AveN); Large (Array[], N); [/code] When invoking functions, you do not need the [], as "Array" itself is the pointer. If you write: [code] void MyFunc(int a[],etc) in your function definition, the compiler converts it to void MyFunc(int * a, etc) [/code] | |
Re: [icode]"%f \t%f\n"[/icode] says print a space, the first value, a space, then a tab, then the second value, then a newline. You need to put a newline in between the first and second rather than a tab. | |
Re: main() returns an int, always. main() returns to the calling system (usually the OS), so there's no point in returning your price value that way. If you must use those ancient headers it's stdlib.h Line 26 has no meaning, especially since you have already outputted your result. Move that calculation … | |
Re: Are you trying to get the filename back from something you've assigned earlier to the BackgroundImage property? | |
Re: [QUOTE=alexchen] The number zero cannot be shuffle. [/quote] Can you clarify what you mean by that? It's not perfectly random by any stretch, but the easiest would be to choose a row and choose a column, check if that element's already in the list, if not add it, if so, … | |
Re: You can separate your prototypes into a header if your instructor wants you to have a header file, so lines 3-11 in MasterG's example (you could put your functions in a separate .cpp file from the main, you just have to make sure you include the header in both files) | |
Re: "sum" in your function and sum in main() are in completely different scopes. Functions have their own set of variables and cannot see anything declared in main or another function. You have a couple of options, either pass both the average and sum variables into your function by pointer or … | |
Re: This will tell you a little bit about how to create your own >> operator for your clock class [url]http://www.java2s.com/Code/Cpp/Overload/Overloadostreamandistream.htm[/url] Scan the string the user enters up until you hit a ':' then convert and repeat. If permitted you can look into stringstreams, but it's not absolutely necessary. | |
Re: [quote]How do I contact one of them?[/quote] On the post in question, hit the "Flag Bad Post" button and type them a short message. (but Ezzaral is a moderator, so you've already talked to one, just sayin') | |
Re: [quote]how to run my graphics in vc++[/quote] The short answer is that you can't. That graphics capability is a library that comes with (older) Borland compilers and cannot be used with other products. There is an older library for other compilers called WinBGIm that's supposed to emulate that Borland library, … | |
Re: [quote]how can i randomly spawn characters in a random array?[/quote] Pick a row randomly, pick a column randomly, check if something is there already, if so pick another row and another column. I'm sure there are more random ways to do it, but for your assignment that is probably okay. … | |
Re: As an aside: never use gets. You can input as many characters as you want, regardless of the size of the buffer, potentially knocking a hole into another part of your program. I had flagged this yesterday to go into C (as the only Cplusplussy thing about it is the … | |
Re: What would you suggest? I've given you hints on the other problems, so I'll leave the burden on you for this one. | |
Re: Check out read() also: [url]http://www.cplusplus.com/reference/iostream/istream/read/[/url] | |
Re: Hint: use a bool variable to keep track of whether you've been upset before. Check whether or not b is zero OR the bool variable is set to true. | |
Re: [icode]std::string[/icode]s don't (EDIT: necessarily) end in [icode]'\0'[/icode] so you have to check and see if you've exceeded the length (which is accessed by the string object's [icode] .length() [/icode] method) | |
Re: A stringstream ([url]http://www.cplusplus.com/reference/iostream/stringstream/[/url]) would work also. | |
Re: That video has the Visual C++ Express Edition featured, which is a great IDE with a very good debugger. Another option is Code::Blocks which comes with the mingw port of the gcc. That IDE has integrated support for the gnu debugger (gdb). Turbo C is a dog that's had its … | |
Re: I don't know if this is a viable idea (so I'm open to criticism), but couldn't you use something like libcurl and "POST" the form data to the URL rather than actually filling the form out on the webpage? | |
Re: graphics.h requires a specific library that is only found on Borland compilers (I don't think the newer Borland products even have it anymore). Look up WinBGIm as a possible alternative (however, it too is quite outdated). | |
Re: You don't need the cin because you are not taking input from the keyboard. Use [icode] checkFile.getline(sCusName,30); [/icode] If you have multiple customers in a file you're going to need a loop to access the one you need. | |
Re: It sounds like you're looking at the Win32 API. The best (intro) tutorial I know of for that is [url]http://www.winprog.org/tutorial/[/url] Keep in mind there are other options like Qt and wxWidgets which are more abstracted and therefore a bit more intuitive to use. There's also WinForms programming which uses a … | |
Re: I did not get those errors when I compiled your program. There are 2 extra semicolons around and you have probably pasted an extra const on two lines. Exception is a class within the std:: namespace so you can't use it as a variable name. What is the specific error … | |
Re: Looks pretty good to me, what is the problem with that function. Your prototype at the top must match your function definition. | |
Re: [quote]Now, is it a good idea to start by drawing all this do you think?[/quote] Are you asking if you have to implement the GUI? I would say that you probably don't. The operator you want to focus on is [icode]==[/icode] so that you have a way of evaluating whether … | |
Re: Hint: you need a for loop or two (one for each of the lines, and one for the spaces, which vary based on how many lines down you are). | |
Re: [QUOTE=ravenous;1417218]You're passing [icode]choice[/icode] by value to the function [icode]menu()[/icode], I think that you should use: [code] menu(&choice); [/code][/QUOTE] The OP has passed the correct way. He's not after a pointer, it was a reference variable. @OP: What are you expecting your function to return? You pass in your arrays by … | |
Re: At least make an attempt to flesh out the function, and someone will be able to help you. | |
Re: For certain, you don't need the semicolons after the if statement on 48,50, etc., just the one after [icode] return 0;[/icode] The reason the identifiers are undeclared is that you are compiling the code as C89 code, which requires all variables to be declared at the top of a block. … | |
Re: No, not a silly question at all. In your Form1.h, look about halfway down and you'll see the event handler "hookup" with the click event for each: [code] // button1 // this->button1->Location = System::Drawing::Point(433, 290); this->button1->Name = L"button1"; this->button1->Size = System::Drawing::Size(75, 23); this->button1->TabIndex = 0; this->button1->Text = L"button1"; this->button1->UseVisualStyleBackColor = … | |
Re: Search for "STL Vector" in youtube or otherwise. A bunch come up. I don't know what your needs are, so pick the one you like. | |
Re: [QUOTE=cscgal] Don't you mean ride a bike before you know how to ride a tricycle?[/QUOTE] I think he may mean learning to ride a motorcycle before you ride a bicycle. @OP find out if you can take an incomplete for the course (you may have to talk to your dean, … | |
Re: Once you put in a number (1st character) and hit enter (2nd character), the input buffer has the extra '\n' from enter. Get rid of it with a cin.ignore() after each of the cin statements. |
The End.