jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

you know that are two sizes of floppies

There were 8" floppies too! (In all fairness I don't really remember them) I think the 5 1/4" were double sided by the era of the souped-up Apple IIe (but you still had to flip em).

briangreen143 commented: spam my ass. who told you im spamming here. watch out ill deal with your reputation. spamming is not my thing. cause i dont even know how to do it. knowing i am new here. +0
thecutest26 commented: loser +0
snipzers commented: why the hell do you keep on attacking people...get lost +0
darzleng commented: so| +0
stellarios commented: we defy gravity...and you are one of the gravity here... +0
jairushudson commented: this aint funny +0
jyrondoron commented: dont care +0
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

When declaring an array, the length must be a constant known at compile time. What you are using here is a language extension for C compilers that allows a "variable-length" array to be defined statically. The downside is that your solution will be non-portable and non-standard as not all compilers support this extension. See http://gcc.gnu.org/onlinedocs/gcc/Variable-Length.html for example.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You can use a stringstream(http://www.cplusplus.com/reference/iostream/stringstream/). Remember to call mystringstream.str(""); at the beginning of your loop to clear it out (otherwise all the filenames will get stuck together as you go). Also, remember that ofstream takes a const char* for the filename so you need to use the .c_str() method of your resulting string (so your resultant string would be accessed as mystringstrim.str().c_str() .

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Grid_pos[2][2] is a single char but you told Print_Grid to expect an array with second dimension 2. If you want to print the whole grid make the function definition void Print_Grid(int i, int b, char Grid_pos[][3]) and pass in Print_Grid(i,b,Grid_pos); so that you get a pointer to the array. Really i and b are not being used in the function body anyway so you don't need them.

perroned commented: very helpful +0
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

but then there is no code

That's very metaphysical. It must have some code somewhere. It's not critical to see, it was just curious that you're having us critique an exe.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

There's a 30 minute window during which you can edit it. If you're looking for the edit button it's on the left under Flag Bad Post.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You forgot to ask "Would you like source with that?" Let's hope it's legit :D

I'd be interested to know which approximation you were using and stuff.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Try it without the Empty Project setting on. Empty starts it without some of the settings that you need (not sure which ones precisely). Just put your code into the [yourprojecthere].cpp file when the project is created. I'll have to look around the menus a bit more but I'm not sure where Rebuild All wandered off to in VC++ 2010. Build is now under the Debug menu.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

i really have lost interest in participating here. i've been trying to care about this site, but it's just not happening.

bye.

Cough..cough...gosh Jep...cough...see you around I guess.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

One way to do it is to have your project2 constructor take a variable of type TextBox. When you instantiate project2 from project1, pass in the textbox from project1. If you're launching them the other way around change the constructor in project1 to receive the TextBox.

"Form1.h"

#include "Form2.h"
...
...
...
...
private: Form2 ^ form2;
private: System::Windows::Forms::TextBox^ tbForm1;

...
...
...
private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
      form2 = gcnew Form2(tbForm1);
      form2->Show();
}

This assumes you'll show form2 when form1 loads, but this is just an example.

The other alternative is to make the TextBox a public member and accessing it in the other class by using project1.membervariable . If that's the route you go make sure your headers are all included in the proper place.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Stuff doesnt show up right for me on IE6

Wow I know some businesses hung onto it for way too long because it was part of their old infrastructure, but time to upgrade that puppy.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I have edited the above post a bit (just so you get the new changes)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Your distance is not being shown on the screen because you don't include it in the cout statment.

An extra newline character in your text file is the culprit. Put the cursor at the end of the last line and hit delete (not backspace). I had thought that it was !infile.eof() that was causing the repeat. However, using .eof() is still a bad idea (see this http://www.daniweb.com/forums/post155265-18.html -- RIP Dave). Use the first getline statement to "drive" the loop.

while(getline(infile,station1,',')
{
   getline(infile,station2,',')
   getline(infile,distance);
   //etc.
}

Also, you haven't converted your distance into the float variable, it is still a string.

kvprajapati commented: Catch sight of! +9
iamthwee commented: *nods* +11
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Oh, and again, minor, but "Originally posted by cscgal" > "Quote originally posted by cscgal".

I'd prefer it as "Quoth the [username]..." ;)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Post your entire code (or at least the header and the file containing main).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You need to turn your struct into a managed one, otherwise you'll have to marshal it back and forth and that will give you a headache (if you have to do it per requirement search for the class Marshal on MSDN).
So something like:

value struct cal
	{
	String^ day;
	String^ month;
	String^ year;
	cal(String ^ day,String ^ month,String ^ year) :day(day),month(month),year(year){}
	
	};

which gives you a constructor to use when instantiating your structs. You can then probably make an array with the number of rows from your file and with 3 columns.

As it were you wouldn't be able to cast your properties out of the array all at once like that. newRecord = (cal*)line; The only other problem is that you need an array<char> to store your del->ToCharArray() call.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

If you are concerned about the vcard you can get rid of it under control panel/Settings and Options(on the left)/Edit options

I'd love to hear them tell that directly

If you hover over Ezzaral's panel on the left of his post, then you can see that he is a moderator.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

@David
I understand your desire to help, but is it necessary to bump 6-8 arguably "junk" threads in a row from 20 days ago when there is a 99% chance that the OP is long gone??

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I am not sure if that made any sense..

Not really, unfortunately. Give us a few of the categories you could place it into and then we might have a better idea.

It sounds like a Morse code program.

Not a bad response. Judges?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

In your function, pass in the 2 chars. Convert them to ints (via subtracting '0') take the sum of the int values and use Convert::ToChar (or really I think you can do a C style cast there) and return that char. It worked for me when I made up a little function to test the other code snippet. I imagine you'll have to modify your method to pass back carry information also.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

oooo

I take it that means it's taken care of... blink twice if no.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Rearrange it like this:

array<char> ^ sum = gcnew array<char>(text1->Length); 
//you may have missed the ^ above

//in the loop
{
  sum[i] = a; 
}
/////
String ^ textout;
for(int i = 0;i<text1->Length;i++)
    textout += sum[i]+ " ";
TxtSum->Text = textout;

When not specified the ToString() method of classes simply returns the datatype. You just needed to output things the old fashioned way (if there's a way to do it all in one fell swoop I don't know it).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

It's because you are using an unsigned int. When the unsigned value is decremented by 1 beyond zero it goes to the maximum value of the unsigned int (see http://en.wikipedia.org/wiki/Signed_number_representations). Using regular ints it works just find since after 0 is -1.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Change i=0 on line 37 to i>=0 (i=0 resolves to false so your loop condition is false and the for loop is skipped)

Also, what's the index of the last element of your string ( reverse1.size() would go one past the end)?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I see what you are saying, feeding back the troublesome points to the OP who references them in his/her own copy of the code. This could turn into a spoonfeeding thing very quickly. "Okay, I fixed the one error, here's the next one." (ad nauseum)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster


I firmly believe at this point we need the compiler output more than the entire source code.

I agree that the compiler output is quite valuable, but without the code it has no inherent meaning.

Dumping of source code should be a last resort.

Agreed. Especially if the OP is at a level where they can pare down the code.

But that's just my opinion anyway :)

That's the case from my end too.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I understand what you are getting at. I agree that sometimes people dump off yards and yards of code when it's not always necessary. However, I think asking for the smallest and yet compilable code can bring about a Heisenberg-like effect.

The more the OP takes out the trickier it is to make sure that everything is declared/applied/called in the right place. The code example in your blog was designed as such, and would only match a handful of cases. One example would be where the OP knew enough to rearrange his code for the benefit of the solver but didn't know enough to catch an elementary bug.

The other danger is when the OP goes to great lengths to "summarize" the code for this purpose. All the compiler error messages essentially become invalid and additional errors can creep in. Also, if the OP doesn't really know where the error is, forcing him/her to guess can take the attention off of the real problem.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Geez... I'm...shocked. Yeah. :D

I knew you'd be back. I'll bet you've been browsing C without logging in.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Changing the -1 to a -1.0 should do the trick. There is no overload of that function that takes an integer for the first argument.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Yes, I had been encouraging the OP towards that idea. He hasn't really done any OOP in C# (or perhaps at all). Now we've lost him to PHP...

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Thanks!

Yeah,ArrayList was a .NET 2.0 thing. I've never dissected them but I believe the List is better designed behind the scenes. I don't know if there's any speed improvement.

Take your time with it. The C++ that comes with the CLR bits is different from standard C++. All the ref classes, handles (^), etc. are particular to the C++/CLI dialect. Just something to bear in mind while you are learning this. If you decide to branch into C# eventually you'll find this to be a hair closer to C# than standard c++ (in that C# and C++/CLI both use the .NET libraries). Just my 0.02.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Grab the .h and the associated .cpp file from here http://mathbits.com/mathbits/compsci/download.htm. Make the .cpp file a part of your project. Google is your friend...

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Because of how the ArrayList stores objects (as objects of type Object ^) you need to cast your ArrayList member before it will give up it's public properties and methods.

ReturnString = (static_cast<PulldownArray^>(PulldownTABLE[0]))->Description;
	
//Consider the List instead, no need to cast
List<PulldownArray^> ^ pdtl = gcnew List<PulldownArray^>();
String ^ returnstring2 = pdtl[1]->Description;

The List is in System::Collections::Generic but if you are using an older .NET you may be stuck with ArrayList

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You set countdown = 5 and when it hits the for loop, the condition is already false (5<5) so it skips the loop completely.

EDIT: Beaten by a hair ^^^^^^^

P.S. Kicking up the warning level on your compiler (so using a -Wall switch with g++ or a /W4 with VC++) would have let you know this

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

for the other part from before it's an issue of

{
   int t = 10;

}

cout<<t; //won't work t is not defined within this scope

So anything on the inside braces, like stuff in for loops (with braces), functions (including main), pairs of braces in the code like the above example. Once the flow of execution leaves the braces, all those variables are destroyed. In your case you had that one variable coming in as a parameter, so it's in scope for the function. So either a) don't pass it in as a parameter, b) don't redeclare it inside the scope of that for loop or c) redesign your function so that both of the above are true.

I'm not sure what you are showing me in that bit of code you posted. Basically your call matches the prototype on line 1 but your implementation of the function has 3 parameters. The compiler isn't sure what to do.

If you're having serious doubts, talk to your professor. Sure he/she could be a cold-hearted you-know-what but there's some chance that they'll be able to help you. It sounds like you don't do well with your book, which is pretty common, but read some examples on the internet (hunt around here in the threads for suggestions of good tutorials too).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

This is a great tutorial on how to do it with MPIR which I believe has identical syntax, and using VS (the author of that blog posts here sometimes, I believe).

If you want to compile it using MinGW you probably need to have something like MSYS or Cygwin (can't help you with either of those) to run the Unix commands to configure and make.

If you're running *nix already you should be able to use the configure and make tools without too much trouble.

I'm not very seasoned in terms of this stuff either but I was able to get the library to work with VC++ Express Edition.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

One question that has been partially in my way while I make this console app; can I link to external classes?

Yes, you certainly can. If you make it part of your project in the same namespace it's even more straightforward, as you just need to make an instance of the class.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

The first question is very common for example: In mr.Stroustrups website, you can look at the interviews section for a hell load of links. (i've gone through a few and hence know )

LOL see that was my point exactly, but thanks for pointing that particular one out.

See if he lurks on any boards for C++.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

<Delete>
Sorry I was looking at the dimensions of the wrong array.

Discussion seems to be continuing at the OP's other thread on this.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I'm trying really hard to come up with something but he has such an extensive website (http://www2.research.att.com/~bs/ if anyone doesn't know it) where he has answered so many questions already.

I might ask him if he's going to come out with a new edition of his book covering C++0x in its entirety.

or
(for some hard hitting journalism)
What language or library does he use that he doesn't want people to know he uses?

mitrmkar commented: I think your "hard hitting journalism" -question really should make to the interview. :) +5
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

So what are the sizes of matchedAsk and ask in the line in your first reply? Check your values for i and x just before you execute the statement matchedAsk[x] = ask[i] .
I think in the second reply you have it going to one past the end of matchedAsk so that's not helping either(I'd have to go over the iterators but I'm not even sure one element is being copied there).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Can you ballpark a region where it crashes? If you have a debugger see where it crashes or put in some cout statements in strategic spots to note the progress. Then I (or someone else) can take a look at that specific spot.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I just responded to your other post (I had figured you had marked it as solved and changed your mind, I didn't know you had started a new one) with a concern about your aver_h in your AverHigh function.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You have a lowercase a (averHigh) in your definition. Change it to capital A.
Note something about scoping in your AverHigh function: it wouldn't let you redeclare aver_h in that position where it is commented out because your parameter aver_h already exists in that scope.
The compiler allows it within the braces of the for loop because that is considered its own scope, but the consequence is when you hit the closing brace all of those variables are out of scope and destroyed.
What you have essentially done is pass aver_h in one end of the function and return the same value out the other.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Keep a counter when you are reading in each of the files and use that number to dynamically allocate the array (using new).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

No, it's a 2D array. Think of a 3D as holding values of a quantity that vary based on both the row and the column they are in. What you've done is essentially constructed a 2D array out of what could be 2 distinct 1D arrays(one holding the highs and one holding the lows)for ease of access.

I'm going to presume you're talking about line 14 above. I told you that 2D arrays are not accessed that way back in post #4. I'm not sure where you're getting that idea from but it's definitely wrong. m_t[row][col] is correct way(unless you want to address it by pointers but there's no reason to do that there).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Display(1) wouldn't work unless your method has a parameter. You could make a bunch of methods called Display1 thru whatever, but that may not be the most effective approach. There are a number of options open to you with string arrays too (so making an array and knowing which elements to pick and combine, etc.).
Definitely look up classes. I've seen people working on RPG type games that expend a ton of effort on sections of it that they could have easily done in minutes with a loop structure or the like. So needing to organize your code into "functions" is at least a step in the right direction.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Okay,so the deal seems to be:

void func(int arr[][2])
{
   //Yada
}

int main()
{
    int arr[2][2] = {{1,2},{3,4}}; //I don't think this makes any difference
    func(arr);
    return 0;
}
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

func(&arr[0][0]); which is just func(arr); If your book is confusing you look for some examples on the net. You need the brackets in prototypes and function definitions but NOT when calling the function.

Arrays are passed by pointer (so actually the value of the address) so when you type int a[] into the arguments of your prototype or definition, it really degrades to int * a . It's not actually passed by reference.

When you define your function as void myfunc(int a[][10]) it ends up being void myfunc(int (*a)[10]) (I believe, I may be off on that slightly) so passing in the address of an array int a[3][10] a is equvalent to (*a)[10], so the call would be myfunc(a);

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I think what you need is a static method within Program to write out some text on demand.

class Program
    {
        static void Main(string[] args)
        {
            Display(); //display your outside message
            Store();   //display your store's wares
            LeaveStore(); //up to you to implement
            Display(); //display outside message again
        }

        public static void Display()
        {
            Console.WriteLine("It was a dark and stormy night");
        }

        public static void Store()
        {
            Console.WriteLine("In this store you can buy a cola, french fries, or a sandwich");

        }
    }

Mind you it's not an ideal solution but it would tide you over until you learned more about classes.