jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

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

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Wherever you set qRear initially (I didn't trace your code all the way back), qRear->next is null.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

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 the compiler is reporting?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

For a function:
In the prototype (up at the top) the names of the parameters are optional (with the prototype you are simply telling the compiler, "there's a function that looks like this that's coming up", hence the names aren't important)

When invoking the function, just the names of the parameters are required (the compiler already knows their type).

In the function definition (in this case at the bottom) both the type and names of the parameters are required (you need the types to specify what the function should expect and the names so you can operate with them in the function body).

So, line 55 is the culprit here.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

the context isn't clear

I don't fully understand what you mean by that.

I keep getting errors

What are they?

Line 30 is definitely not correct, you do not need the datatype when calling the function, just the parameters that you are passing to it.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

It sounds like you're looking at the Win32 API. The best (intro) tutorial I know of for that is http://www.winprog.org/tutorial/

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 dialect of C++ known as C++/CLI, which has a different syntax and can be daunting (and tough to find tutorials on, thought I've heard the Ivor Horton book is good).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

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

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

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

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

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

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

There's a compiler flag you can set for C in Visual Studio. Go to Project/Properties/ConfigurationProperties/CC++/Advanced/CompileAs, and switch to C.

shadowscape commented: you are awesome, thanks alot for all your help, it means alot to me +1
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

For certain, you don't need the semicolons after the if statement on 48,50, etc., just the one after return 0; 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.

If you'd rather this be in C, hit the "Flag Bad Post" button underneath your name and ask a moderator to do so.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I think that i is incremented in the while loop, line 111.

I think you're right! Sorry.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You're passing choice by value to the function menu() , I think that you should use:

menu(&choice);

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 pointer but repeatedly write to the first element. You need to increment i somewhere.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You are correct about that Dingbats. I guess I envisioned the OP checking the number as a next step.

I had suggested that the OP use a character for input in another thread (I think it's the same OP) and check the ASCII value was between '1' and '5', but I don't know what happened with that.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Part of the problem may be the spaces in your filenames. I tried it with 2 files that had no spaces in the filenames, but got this error instead

OpenCV Error: Assertion failed (dst.size() == src.size() && dst.channels() == sr
c.channels()) in unknown function, file ..\..\..\..\..\..\..\..\OpenCV2.0\src\cv
\cvaccum.cpp, line 545

I think because my images weren't the same size.

I don't know what the problem is, but the OpenCV Yahoo group (http://tech.groups.yahoo.com/group/OpenCV/) is probably with whom you should check.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

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:

// 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 = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);

Use whatever method you want in the &Form1::button1_Click portion (it has to be a function with the same prototype as the click handler, that is with the object, EventArgs signature). Any one of your _Click methods will do. So say you had:

private: System::Void AllButtons_Click(System::Object^  sender, System::EventArgs^  e) {
				 //yada yada
				 }

You'd go through each of your buttons and change the last line of each of them to this->button1->Click += gcnew System::EventHandler(this, &Form1::AllButtons_Click); erasing the old buttonN_Click name.

The loop structure doesn't work because these methods are not meant to be invoked, but to respond to a event that happens in the window.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I didn't know you wanted to get that fancy. Just kidding. That usage of cin.ignore assumes a streamsize of 1, change it to cin.ignore(256,'\n'); to get it to ignore up to 256 characters (you can obviously make it ignore more) until it hits a newline.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Good point about the exceptions. There are a couple of minor things I wanted to clarify, though.

You should be getting a warning from your compiler that there's not return value from a non-void function or something. All you need is to do is put return 0; on the last line of main()

This is one of those things that you would expect to be problematic, but if there is no return value specified, then according to the standard, a value of zero is assumed.

I think that Dev-C++ is a reasonable, and much more up-to-date replacement on Windows.

A push in the right direction, but Dev-C++ is no longer in development and uses an older version of g++. A more up-to-date option is Code::Blocks with the mingw version of gcc.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Based on the information you have found thus far, choose an approach and try to implement it. Someone can then tell you if you're on the right track.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

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 back into your function. Think of a function just like one in math, you plug in something and you get something back out. You want to put in the price and markup and get back the price.

P.S. I know you are just starting out, but it never hurts to refresh your reading in whatever text that you have. The more (good) code you read and can emulate, the better you will become.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I was assuming you'd go through and count all of the 'a's and 'A's, write that into a struct, push the struct into the vector, etc.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Use the .push_back() method of the vector.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Line 69: an else statement has no condition, and you have placed a semicolon after it by mistake.

For something that uses a file, try keeping a high score log.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Change line 10 to cout<<Emails<<endl; , that will print out the whole string.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster


Don't you mean ride a bike before you know how to ride a tricycle?

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, or other admin)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

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.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I have hotmail and created a folder,but still counts the MB. I'll try to see if I can export these as text.

Check the specs on your account because last time I checked Hotmail had ever growing storage (they only give you 50 megs or something, but once you fill that they expand it in increments up to 5 gigs as needed).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

The program '[3636] kjega;kew.exe: Native' has exited with code 0 (0x0).

For future reference this means that the program has reached the end of main() successfully.

The pdb errors simply indicate that VS has no debugging information (Intellisense, etc) for those DLLs.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Yes, use an int array as an accumulator:

0xFFFF = 15+240+ ...
       = [_|_|_|...|_|1|5]+[_|_|_|...|2|4|0] + ... = [_|_|_|...|2|5|5] + ...

Summing each new calculation into your array (you don't need more than one, just make sure you have things lined up and do the carries properly. This way you increase your capacity dramatically.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

That number exceeds the largest value of the signed (and even unsigned) 32-bit integer. If you need numbers that large, your instructor may be seeking a solution where you represent your numbers by an array or ints or chars.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

How can we help you if we don't know which errors you are getting?

Also please use [code]

[/code] tags around your code.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Hint: what do lines 26 and 28 tell you about your Function class.

Also, see if you can get some of the implementation of Find. We can't truly know that your professor didn't give you this much with which to start.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Hmmm. I'm not sure then. You don't actually close the files anywhere, though. Is that outside of your control, too? Otherwise I'm at a loss.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Think of a desktop calendar. It's got a grid, with each of the days across the top, and for each of those days there's a block for each hour. You shade in the blocks that are taken. If the block is shaded, it's a true value, if not, it's false. Sorry if I'm being telegraphic, but I don't want to take away from your own process through the problem.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Can you use an array of boolean values? See where you can go with that, or if that's not really what the professor intended then see if you can rework it.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I think you know this already, but the error is in your highest and lowest temp functions.

Your variables are uninitialized and you're trying to get the highest or lowest with just one if statement.

Reread NathanOliver's post:

You should initialize them to the first value in the array and then check from there.

You were right in using a loop before (though you don't need a while, a for will suffice). Imagine you have room in your hand for the lowest temperature, as you're walking along what happens if you find a lower one? Do you need the old one anymore?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Why not make the ofstream elements members of their respective classes? (and instantiate them in the class constructor) I'm not sure if that will solve the problem, but it will make your code neater at a minimum, and global variables are never a good idea.

Also, with the standards, the old iostream.h was replaced by iostream, etc. and string.h by cstring.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You're close - you need cin.getline() (you have the parameters basically correct) to take in the whole line.

Try the following test program to see if it helps you understand the other part of the problem:

char x = 'a';
char y = 'd';
char z = '9';
	
std::cout << y - x<<std::endl;
std::cout << ++y <<std::endl;
std::cout << z - '0' <<std::endl;

Test different values of the letters and look at http://web.cs.mun.ca/~michael/c/ascii-table.html for reference.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster
What is your first name? Jim Bob
What is your last name? What letter grade do you deserve? C
What is your age? 100
Name: Jim, Bob
Grade: C
Age: 100

It's not working fine when I enter a first name with a space, it skips over the last name prompt completely. Hint, you can't use cin when you have a space as it uses a space as a marker to stop taking in characters.

WaltP has given you an important clue. First you need to modify your array approach, as it's unnecessary. Take in a regular char. A char is a 1-byte integer, and therefore you can perform arithmetic on it.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

The prompts are reversed for first and last name.

Also, test your program with a two word first name (like Betty Sue) and see what happens...

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Now, what is the error that the compiler is giving you?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Did you read what I wrote? Start your own thread, post a section of your code. No one can help you if they don't have a context for it.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You don't need the '&'s on lines 7,9,24. You are trying to compare addresses of those values. Once you've passed something in by reference (i.e., using & in the function definition) you just access it like any other variable.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

sam33, please start your own thread for this, and post a small block of code (with code tags) that includes that function call.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You need to reset the counter on or about line 36. Otherwise you are just skipping your while loop each time (you will want to reset your counts around the same point).

Minor point, but int should be unsigned on line 26.

StuXYZ commented: Nice spot +4
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

have an empty mailbox once more

Or sponsor for a larger message quota. :) (Where's my commission, Dani?)

I thought she meant her own personal email, Happy, but maybe not.

happygeek commented: yay! +0
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Please edit your post to include code tags, [code] //put your code here [/code] There's still time to do so.

There is an issue that you are using an outdated compiler and library that most of us do not have access to, so can you narrow down your problem to a few lines?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Here's a sample that moves a circle around the window when you press the button.

private: System::Void Form1_Paint(System::Object^  sender, System::Windows::Forms::PaintEventArgs^  e) 
{
    //get this event from the right hand side of the screen in the form design    
    //  window, click on the the lightening bolt and double click the cell next to 
     //the Paint()
				 
    Graphics ^ g = e->Graphics; //get the graphics handle from the form

    Random ^ rand = gcnew Random(); //random number generator

    g->DrawEllipse(gcnew Pen(Color::Black),
    Rectangle(rand->Next(0,ClientRectangle.Height),rand 
    ->Next(0,ClientRectangle.Width),10,10)); //make a circle in a 10x10 box at some 
//point over the window (box has upper left hand corner coordinate specified).  
//Sometimes it overlaps off the screen, but you get the idea

 //this normally requires a handle to a RectangleF (a rectangle with float coords), but this is an overload.
				 
}

private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) 
{
   Invalidate(); //forces Paint() event to be called
}

(the lines are too long so it looks like hell, but you get the idea).

See if that gets you started in the right direction and you can start translating the Bob Powell tutorial (or one of your choosing) into C++. That graphics object holds all of the methods (drawellipse, fillellipse,etc.). The graphics object only comes from the Paint method, so you'll have to use Invalidate() in your other methods to control it.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Look up the use of the modulus (%) operator.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

So what's the problem? Can you break it down to a specific section or method of one of the classes?