jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

That one I have no idea. It may be in the library associated with cursor.h that you included and then commented out. You wrote the code so I assume you know where that came from.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I'm trying to see if it's possible for the CartSales[y].Cart that are established in the main function are able to be brought down into the JustSold function,

CartsSales is coming into the function. The y value in main is isolated from the method due to scope. If you want y in the method, pass it in as a parameter.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I was just going to add into my post hehe. If you want it to show the message box it has to be >= textBox.MaxLength (or just ==) because the box won't let you surpass the count.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

MaxLength is the constant that you should compare against. I think the comparison would be textBox1.TextLength > textBox1.MaxLength, but I tried it a few times and it looks like you don't need to do anything because once you're at the MaxLength it won't let you add anything more into the textbox anyway.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Your algorithm is missing a piece I think it should be

if (f(x)*f(a) <0)  //sign change between a and x, dump right half
		b=x;
	else if(f(x)*f(b)<0) //sign change between b and x dump left 
		a=x;
	else       //no change no root
		break;//we got it

That being said, I only was able to get no convergence for the [1,2] interval using a super tiny epsilon (one which probably borders on the limits for the machine so may not be valid). If you plot that function you can kind of see what is going on.

One minor detail your labels across the top are in the wrong order it should be k a b x f(x). That was really confusing at first.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Judging from the other replies I bet I misjudged what the OP wanted. Apologies.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Check to make sure there are no excess spaces in either the nicks string or in the pizza_establishment one. I know it's a constant I saw your string schema up there. Otherwise print out the strings right before that point. Absolute worst case go through them both and get the ASCII for each character.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

i never changes within your while loop on line 25, so you're always stuck at 0 < 1 and it loops forever.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

That button is still a valid button. When I put a web browser on my form there's nothing on there with it, the button must have been added along the way. Right click it and check the properties to see what the name is. Then to have your code activate it, run mybuttonname.PerformClick().

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

char EmpName; Char holds exactly that: 1 char. Make it into a string.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

So , is it means that software engineering will include programming ?

More than likely but like Salem said Software Engineering is going to teach programming as a means to an end and may teach important concepts independent of language. The overall picture will probably be more theoretical. That doesn't preclude you from taking more programming classes as electives or as part of a second major if that's allowed. You can always pick up more languages on your own or via an online course but it's more difficult to teach yourself SE because a lot of it is (more than likely) project driven. Check out the websites for programs that you are interested in they should tell you the requirements in excruciating detail.

Salem commented: Yes. +19
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Use the button.PerformClick() method (fill in the name of your control for button).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

cost isn't initialized in that function. If you get to the else section of the if clauses then you won't assign cost and you will return garbage.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

There is nothing in first second or third when you are calling your method. Where should these values come from? I think you mean to pass them by reference, so add a & before each variable name in your prototype and function definitions (but not where you call it)
For example: void commission (double dollars,double & first,double & second,double & third) and change line 8 to reflect this but leave line 22 as it is.
Your other method doesn't require this as you are not changing the values of those variables within the function.

EDIT: And Salem's advice ^^^^^^^^

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

In Solution Explorer right click on your project name (in bold print), go to Add.. /New Item and select header file. If Solution Explorer is not visible go to View/Solution Explorer.

Visual Basic C++ 2008.

We went over this already that is not the name of it. You either have Visual Studio (the full version) or Visual C++ Express Edition. VB never comes into play.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

See this at MSDN. Aside from their void main(argh) you can probably adopt the example they have there (you can leave the TCHAR in as it resolves to the type of the character set under which you are compiling, e.g. char for ASCII). Just make a string of all the chars you want to strip out (so in your case it would look like " \t\n".
You have to include that header (shlwapi) which is only in Visual Studio I believe.
For alternatives see something like this but read the comments under each one to get the limitations of each. They go by order of popularity but I think the second one may be better, IMO.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Try them as:

#include <climits>
#include <cstdio>
#include <cstdlib>

These are the includes for use in standard C++ programs. I'm not sure what that other file is. A brief net search indicates it might be a *nix file which you will not find in the Visual Studio and may need to find a substitute.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You can use the degree of the polynomial to allocate an array of size degree+1 (to hold the constant) for each line. Your degree will let you read ahead to see how many times you should go through a loop collecting coefficients and then just grab the last 2 values.
Using your example:
3 1.3 0.9 4.7 2 -5.4 5
1) Read in 3
2) Create a matrix of size 4
3) Have a loop that reads in just 1 coefficient value, repeat it the degree of the poly + 1
4) Read the last 2 values for the bounds
5) Do the integral
6) Delete the array

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Try changing line 32 to while(inFile >> inValue) and remove line 33.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Not to beat a dead horse (or a turned-in assignment) but where were you putting the () and the ' ' ?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Where is the value for y coming from in that method? You declare it but you don't assign any value to it.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Ok. Have a bit of patience with me here - i'm totally newbie at this.
I get what you're saying about removing the 'A' argument and i've removed that. When you say that i dont have to call my datatype i'm not sure what other way to do it. This is how we've been taught (at least up til this point)

I have patience don't worry. You get close to it and then you take a detour, hehe. I meant take line 5 and move it in between lines 9 and 10. Leave your call on line 10 alone. I meant on line 17,24 etc you are recursively calling your function for some reason. There's no need to -- once you're in the method you know that you have passed that type of variable to it.

each parameter type, be it long, double, float, unsigned long integer etc, is supposed to return a specified integer.
if the parameter is an integer type it should return lets say a 1,
if the parameter is an float type it should return lets say a 2, a character would return a 5 etc.

I figured that out after I wrote my reply. I was alluding to using a string but this is your requirement, I understand. Well this one you can do simply by returning the number you want. If you're in the long double method, just return 1. No need for the newline or anything.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Ok. You're in main and at the end you hit a return 0; what happens to the program? Exit time. Not what you want. Take it out.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

The problem there is that A is not assigned any value before putting it into the method. Take it out of global space (there's no reason to have it there) and put it in main with a value.

You don't have to call datatype from within your datatype functions. The key here is that the compiler makes the decision for you as to which one to call. Once it's got the type of the variable (though there could be some promotion going on but let's assume that away for now) it picks the method.

I think you're right in having your methods return the same type of variable but what kind of information can an int give you? What if your methods could speak, well in a way they can...

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Take the infile into not str (as that has your users word) but tempstring or something like that.

while(infile >> tempstring)
{
     if(tempstring == str)
         num++;

     count++; //do this regardless
}
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Hotdogstand is your class, so it's a type. It's not int Hotdogstand[] it's gotta be of type Hotdogstand[].

void HotDogStand::JustSold(int DogCounter, int numCarts, int HotDogStand[])

should be

void HotDogStand::JustSold(int DogCounter, int numCarts, HotDogStand CartSales[])

and you have to pass in CartSales (no brackets) when you call the method in main(). Note that the parameter of your method JustSold could have been HotDogStand myHotDogStand[] (any name here) it doesn't have to match with the variable in main, just the ones within JustSold itself.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I would use 1 while loop (just like your second one) and put an if/else in there to distinguish between matched words and regular words and then up the count on each when appropriate.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Close but no cigar as usual. I'm really on a roll tonight. It's right here on line 165: [b]return choice;[/b] It looks like you dumped your Menu() routine into the main code body and never took out the return statement.

where will i define that function

I would just clear out line 168 completely (and the prototype at the top). You already have the "choice" value from the prompt above that.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You need a definition, yes. If your program is trying to call a function that wasn't defined it will crash (I haven't attempted to fill in a definition for menu()).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Where is the definition of menu()? I see it declared and I see it called but nothing else. It seems to be where it's crashing.

I wish he didn't bring it up

That's my bad. I misinterpreted the whole thing up until I finally saw that OP had written his own function gotoxy as it was commented out -- no excuse I know(I only saw the prototype before). I thought he was trying to get something originally done under Borland with graphics.h to work under Dev. by declaring the prototype just to quell the compiler. Wow. Yeah...

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

the program compiles and runs fine

This wasn't what you said in your first post. How did you get it to work?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I already know about Borland.

I kinda thought you would've but since it came out after TECO I figured it was worth mentioning. :D I'm not expert on Dev either but I'm fairly certain that the gcc doesn't have it in the libraries (and I went through this with another poster trying to find an alternative).

The solution ends up being a library like pdcurses which has equivalent constructs.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

finds the last whitespace in that substring

Overlooked that bit, apologies.

string Formatstring(string input,int length,string suffix)
{
     string tempstring = input.Substring(0,length);
     int lastindex = tempstring.LastIndexOf(' ');
     return (input.Substring(0,lastindex)+suffix);
}
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You don't need the delay function, use a timer. Drag one over to your form from the ToolBox (or create it in code). Place your Move_circle method into the Paint event of the form. Within your timer call Invalidate() with each cycle which will invoke the Paint method.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I believe it's a non-standard BGI function from Borland's library. It's probably not going to be included with the Dev-C++ gcc.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You would need to make this a static member of a class to use it but the basic gist of it is like

string Formatstring(string input,int length,string suffix)
{
     return (input.Substring(0,length)+suffix);
}
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Prototypes are not required to be at file scope.

Noted. I'd never seen it done that way, false assumption on my part. Thank you.

There's absolutely nothing wrong with it.

The prototype doesn't match the definition, unless I'm missing something again. I do agree about the call being wrong.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

if (next == '#N#') '#N#' is not valid. Single quotes are for a single character (but can hold escape sequences like '\n' for newline). Make next a string, use a getline to read it in and then compare it with "#N#" instead.

Also, don't use feof. Use your getline(fin,next) (see first paragraph) to drive the loop.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

The first question to ask is where do function prototypes belong? Not in main(). After that you should compare the prototype for the function list with the definition of it down below. They don't match. After that it's some minor adjustments once you decide whether you're passing the pointer or not.


And please learn to use code tags -- http://www.daniweb.com/forums/announcement118-3.html

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I draw the "background" first (in this method), and the foreground changes

The difference is twofold. First, your background (I'm guessing) probably requires a lower refresh rate. This way you can update the background only 3/4 as often or whatnot and give some of the performance to your foreground elements. Also, each timer is in its own thread. That may be one of those "for better or for worse" kind of situations. See this about having 2 timers work together.

I'm not familiar with InvalidateRect but the information I found on it would lead me to believe that you can specify a region of your window to invalidate (like if you had a rapidly changing region and perhaps didn't need to repaint the rest of the scene as often). Analogous to the way Invalidate() calls the Paint method of the form in .NET, InvalidateRect works at a more fundamental level. I don't know the details. It's a Win32 function so it means you'd have to use DllImport with it to use it with .NET (there's a MFC version too but that won't help you in this instance).

Take a look around about double buffering. I don't know the answer to that one. I know that Panel doesn't have a double-buffering property to change but I don't know whether it falls under the blanket of the entire form.

I wish I had more information for you. Poke around in the C# forum archives for the answers …

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

On line 43 initialize it as char ans = 'n'; (or anything else besides 'y' really). Since ans is not getting a value except for in the default case of your switch block it's entirely possible to go through that without getting a value for it, therefore it doesn't know what to use.

EDIT: Adatapost is suggesting to set it to 'y'. My suggestion does not contradict that but I assumed that you'd want to default to going through the loop once if the choice was not presented to the user (rather than going around again).

sourav_kings commented: cool +0
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

choice is local to the method it's declared in. However if you declare a variable choice in main (it could be called anything really I was just matching it up with your switch statement) and use it like choice = Menu(); Then it will display the menu and assign the option chosen to the variable choice back in main.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Put two slashes in front of line 1. After line 1 insert the following:

int main()
{
  return 0;
}

I'd hold the envelope to my forehead but that's just been overdone.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

That's really neat. My first thought is talk about a way to blow through your disk space!

at least for average amounts of infinity

Sure... :)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

What I meant was that if you wanted to step by +1 for your loop that you could do 10-m so for 0,1,2,3 it would go 10,9,8,7 but CP's method is more straight to the point.

So what do you need on the code you have just posted (not sure what happened with the code tags it seems like they skipped)? For the + sign (surprise) you need the nested for loop again. Spaces can be used to your advantage, plot it out on paper. I'm not sure what kind of error trapping you are looking for.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Yes, I think since you do not know where the //// will be then you have limited choices. I think if you tried to designate what those variables should be and one of the numerical ones reads //// then the stream will go bad and the rest of the reads will fail.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Ok, so you want the second side to be at the top rather than the bottom?
****
***
**
*
(I'm assuming)
So for your second loop say number was 10, you'd want to have rows of length 10,9,8,7... (with the m=0, (ignore the stop condition it's not correct), m++ your loop would be going ___? (from what to what).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Your function declaration(s) (hint there) will go into your header file. So like what you have in your second code box but with a name of the function. Think over how you're going to determine which is which.

You don't need to declare your variables outside of main() like that.

Also, on your first code block you need an = between code and C (or CODE=C++ works too).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

The best way in your case (with the .NET) is to create 2 timer objects, one for the "background" animation and one to pace the foreground changes.

You can have two methods, one in each of the timers (one for drawing the foreground elements and one for the background) that makes all the necessary positional changes and then you can call Invalidate() at the end of the timer_tick event.

Also important is to go to the properties page of the form and make sure double buffering is set to true.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Could you post up a larger portion of the code so I can see what you're extending. If this is the ToString() for your class specifically then you'll have to get all the information from the individual rectangles themselves. I'm not sure what the rectangle ToString method outputs.

In all likelihood you'll need a foreach statement and then return the myRectangle.Height.ToString() and myRectangle.width.ToString() where myRectangle is your object.