jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

To answer your question:

No the ROM was not a issue.
The man at the store told me that I would never run out of 20meg of hard drive space.
Considering a ROM chip could store a large amount of information and was only ever read from. I believe the ROM was only used to get the computer started , and not typically used to run the computer.

[OT]
I was teasing because you said you installed your first OS in 2002. If you hadn't installed it, I was joking that it must have been in ROM when you got the PC (I think the Apple II OS was in ROM, or at least the BASIC interpreter was). Surely these earlier PCs had some OS (DOS perhaps).
[/OT]

I personally think that Narue dresses like a ninja and bounces her small child on one knee while furiously navigating DaniWeb on her iPad. She has a voice activated IDE which parses her oral scripting language into code segments. I imagine that in addition to her ninja training she's also trained as a markswoman in the armed services and can steady her heartbeat under her own volition... that's just a guess, though.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Yes, you did. Thanks for clarifying. The text box is probably not accessible through your program. I don't remember much about the web browser control, but I don't know that you can pick out elements (like you could in DOM scripting in JavaScript). I think using the HTTPWebRequest type functions you could do your own POST of the page, but I don't know enough about that to help you.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Am I correct in assuming you're doing a Windows Forms application? The textBox has a Focused method (http://msdn.microsoft.com/en-us/library/system.windows.forms.control.focused(v=VS.100).aspx , for the latest incarnation, but it goes back to .NET 1.1).

It can't be a cursor

It is still referred to as a cursor, as it was called that long before there were mice or windows hehe :)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

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 at all, this might be a good example to implement (I think that's what arkoenig was getting at, but I don't want to speak for him). I believe the STL uses a quicksort, so if you have a debugger that lets you step into the library code, you can take a look at it in action.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I found http://www.qtcentre.org/archive/index.php/t-3604.html 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.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

getline and get have the same problem. Check out http://www.cplusplus.com/reference/iostream/istream/getline/ and http://www.cplusplus.com/reference/iostream/istream/get/ the prototypes are at the top of the page. fgets from <cstdio> does return the c-string that it reads in, but to get an integer out of it you'd need another function.

Out of curiosity, is there a reason you are opposed to having 1 extra line in the code?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

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 http://www.winprog.org/tutorial/ if you are interested in the Win32 API.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

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 declared variables.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

for ( WordsToAnalyze; WordsToAnalyze[StringPointer] != ' '; ++StringPointer) You went back to this again, and the syntax is not correct.

I agree with WaltP, put some debugging code in there to see what's in each of your arrays at any given time (simply print them out character by character).

Don't get mired down by one exercise so much that you give up your quest, though. It never hurts to take a step back and look at the big picture, IMO.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

No problem. Your specification at first sounded a bit like an assignment, which was why I hesitated, I wanted you to find some of it for yourself if that had been the case. I meant no hard feelings.

Happy holidays!

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You need a prototype for your method (I tend to reserve function for procedural programming) in the header file like: int AnyFunction(); under the "public:" section.

and

int clsHelloWorld::AnyFunction()
{
    return 1;
}

in the .cpp file.

I think the equivalent of a procedure in C++ would be a method "returning" void.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I think we overlapped. That wasn't in response to what you said. What do you mean by a procedure?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I know it's not exactly what you are looking for, but see if you can adapt it (I don't want to take away all your fun!)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

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 to receive help when you do such things)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

To have your class interact with the form, you need to send in an instance of the form:

public ref class ClassData
	{
	private:
		System::Windows::Forms::Form ^ frm1;
	public:
		ClassData(void);
		ClassData(System::Windows::Forms::Form ^ frm1);
		void ChangeButtonText();
	};

Then declare an object of the class in the private variables section of Form1.h: ClassData ^ Cd; . Instantiate it in your Form1 constructor or wherever, passing in the form as "this". Then use it as you would any other object (so you can call Cd->ChangeButtonText();

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

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 few good sites out there like http://www.functionx.com/vccli/index.htm but honestly if you want to do .NET programming and you're just starting again you're probably better off with C#, IMHO.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

My impression of XML was that it has the angle brackets <> instead of square brackets []. Perhaps you can do a global search and replace on your document before you process it.

There are a host of methods under the System::Xml namespace (see http://msdn.microsoft.com/en-us/library/system.xml.xmltextreader(v=VS.100).aspx) where you can extract the properties of each node. It's not something I'm very familiar with. The best thing to do might be to setup a reader and step through a known document, printing out what the methods are returning(MoveToNextAtrribute(), etc).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

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.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

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.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Actually, another thing that I did was append a space after the last word of the input buffer, as if you type "done" and it's not followed by a space, the loop will run over the end, as WaltP has pointed out. I had brought this up a while back, but I think it got lost in the shuffle.

You can scan along your buffer and find the last letter and drop the space in.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Speaking of consecutive posts... Seeing as how this has not garnered any further support and the suggestion has been "suggested" I will mark it as solved.

Happy Holidays everyone.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

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

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

The statement after the comma on line 30 does nothing, but you're onto the right idea. You need to add a null terminator onto wordAnalyzer. Then you can skip the strcpy and compare it directly. I don't think that strcpy will append a null character if the originating string doesn't have one, but I'm not intimately familiar with the <cstring> functions (I know for a fact that it does copy over the null character if one is present).

The only difference between your code and mine was that I appended the null character and did not go through the strcpy step.

Honestly, I think if you've come away with some appreciation for the character array as a basis for C-strings (and later you can compare them to std::strings) and understand why they are manipulated the way that they are, then you're probably fine.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Under Project/Properties/ConfigurationProperties/Debugging/CommandArguments

Tellalca commented: Thank you, that helped! +1
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

char name;

is the same as

char name[1];

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)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Oh, sorry. You need a using namespace System::IO; up at the top (or qualify each like System::IO::StreamReader )

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I believe the switch is "-E" to preprocess but not compile.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Use a streamreader for the first one, a streamwriter for the second.

StreamReader ^ sr = gcnew StreamReader(filename);
String ^ temp;
while(temp = sr->ReadLine())
    listBox1->Items->Add(temp);
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Go into your Form1.h and find this section:

public ref class Form1 : public System::Windows::Forms::Form
{
    public:
	Form1(void)
		{
  		    InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}

    protected:
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
	~Form1()
	{
		if (components)
		{
			delete components;
		}
	}
	private: System::Windows::Forms::Button^  button1;

and add: private: video ^ video2; to the end. Now you can access it from both methods. Make sure your header for video is included in Form1.h.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

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.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You have to declare a Prog object in main. Your class is defined in an awkward way where you're passing private member variables around (they are contained in the object, so you don't have to do that).

So without having to pass everything around, it might look like:

Prog myProg;
myProg.ReadList();  //since A is a member of your class, why pass it in
myProg.Avgs();
//etc.
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Declare video2 as a private member variable of Form1.

Juginx commented: very helpfull +0
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Why not just save it in a string and carry it along? I'm not sure that information sticks with the pictureBox (MSDN says that there is metadata available, but I don't know if that includes file name or not). Worst case you could make your own pictureBox that inherits everything else and includes a filename property.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

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

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

my prof didn't teach it to me

That's what that thing made of paper and cardboard that's propping up the leg of your ping pong table is for. Failing that, Google.

and also the class and I find hard, anybody can teach me how to cout results..

Can you clarify what you mean by this?
For example:

int a = 10;
std::cout<<"a= "<<a<<std::endl; //skip the std:: part if you have a using statement
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Choose an x from the range of x, chose a y from the range of y, choose x1 from the range of x, choose y1 from the range of ys.

If list[x][y] or list[x1][y1] is 0, neither is swapped and a new set of x,y,x1,y1 is chosen.
Else, swap list[x][y] and list[x1][y1] and pick a new set of x,y,x1,y1

It's not as random as can be, but it should suffice for your assignment.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

See your other thread, there's no need to do this as a class.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

It's not a problem, it's what I was trying to say in my last post anyway.

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

Lines 3-11 above go in the header, lines 13-17 go in the main.cpp file (be sure to include Prog.h in main) and the remainder can go into prog.cpp. To make life easier, include them all in a project or compile both cpp files at the same time.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Your sum function is only taking the last value entered by the user as stated below:

sum=a[x];

The code comes after the for loop. At this point, the value of 'X' would have been 10 and its surprising that you are actually able to execute your program without problem. In fact, it would have crashed because you are trying to access invalid array index.
A simple modification to your for loop in main function would have solved the problem.

This is true. I think the OP is trying to relegate the sum portion to his function, so he/she should probably just delete the sum=a[x] line altogether.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I don't know the specifics between 2005 and 2008. If I were to hazard a guess, the compiler is the same or better at complying with the standards as versions increase (some of those issues discussed http://msdn.microsoft.com/en-us/library/x84h5b78(v=VS.80).aspx (drop down the menu to change versions)).

I don't want to speak to the differences because many of them are nuances, but you can always test your code with multiple compilers to see the real story.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Sorry, I thought you meant
x1
y1
x2
y2

What are the data types of all of the variables?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

"%f \t%f\n" 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.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

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)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Maybe what you're looking for is:

int* list = new int[Width][Height];

Did you try that in the compiler? It doesn't work. For a dynamic nthDimensional array you have to build it up.

[rows,columns]

int ** my2Darr = new int*[rows];
for (int i = 0;i<rows;i++)
     my2Darr[i] = new int[columns]; //for each element of the row array, make a column array
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

The number zero cannot be shuffle.

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, choose a new row and column. I understand what you are trying to do, but I don't think it's the best approach.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Check into using getline with a ':' delimeter, otherwise you can do it character by character like I was suggesting before, say the user enters 12:05:15 =>

Add '1' to a temporary string, count =1, add '0' to the temporary string, count = 2. We've reached a colon, note it and stop counting.

Convert the characters to numbers and add their place values:

subtract '0' from '1' to get 1, then *10^(count-1) = 10
subtract '0' from '2' to get 2, then *10^(count-2) = 2
Add them to get 12

Scan up to the next colon doing the same thing. The advantage of your situation is that you know that there are only 2 digits in between colons, so your multiples of 10 are always going to be the same.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I installed my first OS in 2002

Did the OSes for your earlier computers run out of ROM? ;)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster
ReadList(Array[], N);
Avgs (Array[], b, Ave, AveP, AveN);
Large (Array[], N);

When invoking functions, you do not need the [], as "Array" itself is the pointer.

If you write:

void MyFunc(int a[],etc) in your function definition, the compiler converts it to
void MyFunc(int * a, etc)
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

By the way what compiler are you using?
I'm currently using the latest Dev C+=

I use VC++ 2008 and 2010 (Express Editions, someday I'll take out a mortgage and get the full Visual Studio) or Mingw (g++ 3.4.X which I know is outdated, I'm migrating to the 4.4.X). They all have their strengths and weaknesses.

Dev-C++ uses an even older version of Mingw, so you're better off with Code::Blocks, or another IDE, which comes with a newer version of the compiler.

jember commented: Thank you. This is a great help for me +1