2,045 Posted Topics

Member Avatar for linova

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).

Member Avatar for linova
0
204
Member Avatar for seanbp

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 …

Member Avatar for seanbp
0
377
Member Avatar for VernonDozier
Member Avatar for VernonDozier
0
174
Member Avatar for bleedi

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.

Member Avatar for bleedi
0
236
Member Avatar for localp

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 …

Member Avatar for jonsca
0
169
Member Avatar for localp

Never done it, but it sounds tractable: [url]http://weblogs.asp.net/twalters/archive/2003/12/29/46265.aspx[/url]

Member Avatar for localp
0
81
Member Avatar for ultrasurf123

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 …

Member Avatar for ultrasurf123
0
112
Member Avatar for hunt4me619

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.

Member Avatar for jonsca
0
146
Member Avatar for Unhnd_Exception

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 …

Member Avatar for Unhnd_Exception
0
182
Member Avatar for I am a beginner

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 …

Member Avatar for jonsca
0
95
Member Avatar for Rubinder singh

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.

Member Avatar for JSPMA1988
-1
228
Member Avatar for jackmaverick1

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.

Member Avatar for jonsca
0
282
Member Avatar for jonsca

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 …

Member Avatar for jonsca
0
242
Member Avatar for Tellalca
Member Avatar for sundip
0
140
Member Avatar for zit1343

[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)

Member Avatar for Saith
0
152
Member Avatar for vbkumar

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.

Member Avatar for vbkumar
0
147
Member Avatar for Juginx
Member Avatar for icasta13

[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]

Member Avatar for jonsca
0
220
Member Avatar for phobos666

[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.

Member Avatar for saad749
0
154
Member Avatar for Lando_

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 …

Member Avatar for jember
0
2K
Member Avatar for Martje

Are you trying to get the filename back from something you've assigned earlier to the BackgroundImage property?

Member Avatar for Martje
0
161
Member Avatar for alexchen

[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, …

Member Avatar for jonsca
0
126
Member Avatar for icasta13

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)

Member Avatar for Fbody
0
116
Member Avatar for blueyelunatic

"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 …

Member Avatar for jonsca
0
89
Member Avatar for MysticMan3000

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.

Member Avatar for jonsca
0
148
Member Avatar for musikluver4

[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')

Member Avatar for Dani
0
187
Member Avatar for Awah Mohamed

[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, …

Member Avatar for Basteon
0
344
Member Avatar for mpike

[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. …

Member Avatar for Dingbats
0
411
Member Avatar for CrazyPixel

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 …

Member Avatar for jonsca
0
171
Member Avatar for bookmark

What would you suggest? I've given you hints on the other problems, so I'll leave the burden on you for this one.

Member Avatar for MasterGberry
0
127
Member Avatar for lochnessmonster

Check out read() also: [url]http://www.cplusplus.com/reference/iostream/istream/read/[/url]

Member Avatar for jonsca
0
83
Member Avatar for bookmark

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.

Member Avatar for jonsca
0
127
Member Avatar for bookmark

[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)

Member Avatar for bookmark
0
260
Member Avatar for by_stander

A stringstream ([url]http://www.cplusplus.com/reference/iostream/stringstream/[/url]) would work also.

Member Avatar for jonsca
0
237
Member Avatar for sanjuanair
Re: How

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 …

Member Avatar for seanbp
0
116
Member Avatar for johngalt10

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?

Member Avatar for jonsca
0
100
Member Avatar for Anuradha Mandal

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).

Member Avatar for Anuradha Mandal
0
1K
Member Avatar for samoz83

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.

Member Avatar for jonsca
0
81
Member Avatar for DevonParsons

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 …

Member Avatar for daviddoria
0
164
Member Avatar for sharifyboy7

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 …

Member Avatar for jonsca
0
320
Member Avatar for Lando_

Looks pretty good to me, what is the problem with that function. Your prototype at the top must match your function definition.

Member Avatar for Lando_
0
1K
Member Avatar for Violet_82

[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 …

Member Avatar for Violet_82
0
91
Member Avatar for johntodo

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).

Member Avatar for alexchen
0
142
Member Avatar for bretttmczk

[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 …

Member Avatar for bretttmczk
0
235
Member Avatar for johntodo

At least make an attempt to flesh out the function, and someone will be able to help you.

Member Avatar for frogboy77
0
132
Member Avatar for shadowscape

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. …

Member Avatar for shadowscape
0
571
Member Avatar for David_Omid

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 = …

Member Avatar for David_Omid
0
152
Member Avatar for Hayzam_#include

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.

Member Avatar for Hayzam_#include
0
82
Member Avatar for groedius

[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, …

Member Avatar for groedius
0
149
Member Avatar for sha11e

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.

Member Avatar for jonsca
0
111

The End.