jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

The sizeof() operator is giving you the size of the pointer named "buffer", which is 32 bits (4 bytes).

Just use bufflen for the size of the buffer in the get() call.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

You have made a way to resolve code half-life, but missing something I want to help it ..

Fuvction which solving the equation of the third degree in how to enter transactions have, I mean how can I insert s q v g

I apologize, but I only get the basic gist of what you are trying to ask. Can you please clarify what you mean.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

P.S : I'm a she

Pardon my assumption, then. ;) Glad the code is working now.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

He was missing the copy constructor declaration within the class, though.


(4000) - ignore this, just a counter

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

From the errors you were getting, did you try the include guards that thekashyap was telling you about? That would probably take care of the redefinition errors since you're including everything in everything else. Try those first and then I'll try the full project.

EDIT: I added the include guards to each of the headers and added:

VendingMachine(const VendingMachine & vm);

(the declaration of the copy constructor that you had defined in VendingMachine.cpp) and it compiles fine (one warning about unused variable 'a' in main()).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

If you're not opposed to doing so, zip up your project folder and attach it. I feel like I don't have enough to go on with what you have posted. Also, in testing the code I had to substitute in for the Cigarette class etc.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

College seemed tough at the time, and in many ways I wouldn't want some of that pressure back, but really I'd give anything to be back to the good times. I'll take the wisdom I've gained in the (runs hand over my mouth to conceal the number) years since I've been out, though, and I'll be golden.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I don't see VendingMachine.h/cpp posted, so I don't know how you say that.

Sorry, you are right, I read your response too quickly, I thought you were talking about VendingDisplay.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

don't have only some non-default c'tors

Wha? He does have the default, but in his small example (which may represent only a portion of the actual situation) it's not defined anywhere.

I think that he's trying to pass an object that doesn't match the signature to it when he's instantiating the object in main (and so the error message was one of those "defined from here" compiler messages).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

What did main look like where you were trying to instantiate the object?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Take a look at the example at the bottom of http://www.cplusplus.com/reference/string/string/find/.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Are you allowed to change the signature of the check2 function?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Please make an attempt at the code and post it with specific questions.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Can we trust the Encyclopedia Britannica?

I get suspicious when they refer to America as "that colony that temporarily got away."

Personally, I trust articles with lots of numbers in brackets that lead to what I would consider good sources. Since the claim on the Daniweb article doesn't come from anywhere, it's immediately suspect. It's meant to be user-created, but that doesn't imply people should make it a creative writing exercise.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Ok i got wxwidgets but have no clue how to install help!!!

I think Dev is going to be one of the larger obstacles to that, as it's outdated. Honestly, I've never conquered that one myself. I know there's a build of it for Windows systems that lags behind the main release by a couple of versions, but I don't remember what it's called.

Can i do this program in java?

Why don't you ask in the Java forum? :) Yes, I'm sure you could, but there is a learning curve to anything. If you know Java and can familiarize yourself with whatever GUI toolkit they are using these days, then sure, but the same holds for C++.

Poke around the net for solutions to installing wxWidgets and if that doesn't pan out, start a thread (here, or in their forum,http://forums.wxwidgets.org/) with a concrete question about installing it (not just "it doesn't work").

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I'm sure no one would get upset if you did more than the allotted set. My perception is that most lecturers here in the states have a predefined set of learning objectives (put forth by the department or a curriculum committee), and they have to try to adhere to that for the material. So, they probably pick and choose based on that, and speculatively, that they don't want to get bad ratings for giving too much "extraneous" work.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Yes the characters remain in the stream

Try it with 2 char arrays that you declare one right after the other, which don't have to adjoin in memory but with such a small program they often do, then write more into the second one than it can hold. If you print it out it's clobbered the first one.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

If someone inputted a string that was 15 letters long, would the leftover characters after the null terminator be discarded? or would they remian in the input stream?

What I was saying in the post above is that in this case, they actually end up clobbering the memory adjacent to the array, so however many characters you have beyond the limit writes over whatever is next to it by that many bytes.

Say we have char arr[4], and there's a second array of size 4 next to it with "abc"
|   |   |   |   |'a'|'b'|'c'|'\0'|
cin >> arr; //we enter "123456"
|'1'|'2'|'3'|'4'|'5'|'6'|'c'|'\0'|
Not only does cin not put the null terminus on (as there's no room), but we've clobbered the other array (as a side effect, any function relying on the position of the null terminus will think this string is "123456c".

And on one last note: is there a way to expand my character array size once it's defined?

i.e. I declare char input[7]. Am I able to, down the road, change [7] to, say, [12]?

Not with a fixed-size array. There's a way to do it (realloc - http://en.wikipedia.org/wiki/Malloc#realloc) if you dynamically allocate the array at runtime with malloc (a C function that is,in some ways, a predecessor to the "new" keyword in C++, but also, I believe, still used in a lot of the underlying machinery of C++ memory management). Look up "new" and "delete" if you want to know how to do things …

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Yeah, I see what you are saying. You just have to know what position the field you are seeking is in, so you can go up to the start of that group and start clearing.

lost                <---------------------------------
cat       Go back n spaces,clear on down to mangerton|
female                                               |
persian >------- Search is for persian, this matches |
0 3
black-white
mangerton
42614297
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

i am kind of bossing you guys around

We wouldn't let you actually do that, but thank you for owning up to the issue.

C++ will work. If you opt to go the Visual C++ Express Edition/winforms route, the dialect of C++ used is C++/CLI and has a slightly different syntax, so give that one a second thought if you are thinking about it.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Can someone just give me the code and programs for the program please!!!

Any term papers we can write for you, too? Can I pick up your dry cleaning? ;)

It's at this point that you need to do what rubberman suggested. Find one that you can download for her. I know I'm not going to take you through the minutiae of writing a GUI program step by little step, and judging from the response to your question, no one else is either.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Cout

Int

Cin

Tell me those statements compile on your machine, and I probably won't believe you.

Perhaps you missed the point of my other post. If you don't know which GUI toolkit or system you want to use, then you're not ready to start programming in it.

IMO, it makes life slightly easier in most OO GUI toolkits if you have all of your own code organized into objects. What you have there is not sufficient.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

non similar matches

I'm not exactly sure what you mean by that.

Just use strcpy with a blank string to "erase" that array element.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Oh, no, miscue on my part then. I meant that you can use >> with char arrays. It's conscious of the need for '\0' at the end. You can put in more characters than your buffer will hold EDIT: and it plows through to the adjacent memory. It will only put the '\0' if there's room.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I omitted the cin portion, is that what you mean?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

input[8] is not the last member of your array, input[7] is.

When you declare the array you put the size, when you use the array, you put the index.

After taking in the input, you could say

if(input[7] != '\0')
   input[7] = '\0'

What I think you were doing is trying to march down the string, which you can do by

int i = 0;
while(input[i] != '\0')
{ 
   cout<<input[i]<<" ";
   i++;
}
(it could be a for loop too, I was just using while because you did)
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

if you aren't into programming it yourself

I think the OP is into it and has good initiative. I just know from personal experience that jumping into Windows programming can take a lot longer than one originally intended.

@rubberman I think your suggestion of a ready made is a good one. If any of them are open source, that's an even better opportunity for the OP.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

in my code, i dont use int values, because i manage a lot of data.

That doesn't make a lick of sense. Sorry to be so blunt, but I don't understand that at all.

Give Lerner's suggestions a try and see what happens.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Where do you modify c2 in the loop? Also, why is it a double?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

i need exact instructions on what to do

You're asking a lot from us.

You need to do some background reading on Wikipedia (see for example: http://en.wikipedia.org/wiki/Widget_toolkit and http://en.wikipedia.org/wiki/Win32 for some of the background on that other tutorial I linked for you) and decide which toolkit you want to use.

Win32 tends to be the more powerful option, but takes pages of code to get a simple window functioning. The other options cover some of it up for you, but it still takes a lot more than you're probably thinking it will.

I'm not trying to discourage you in any way, even though it might seem like it, but just the opposite. I just want you to know what you are up against, and I want you to be able to know what the options are before you choose one. Are you just getting started with C++ in general?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

That's a great quote for your sig: "Nobody goes there anymore; it's too crowded." -Yogi Berra

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Your inner loop is going to control the columns (it's a bit confusing because people usually specify dimensions as m rows by n columns, but you've done the opposite), so the inner (j loop) should go to m and your outer (i loop) loop should go to n.

So your loop hits the first row (i = 0)
Then goes and hits each of the columns (j = 0,1,2,..,m)
Second row (i = 1)
Then each of the m columns again
Etc.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Glad you got that part of it working!

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

What I did find annoying is posters asking questions about the basic stuff, which is hard for them to grasp, and before you can say "code", they post an even more advanced question, trying to get to the much more involved topics in a sudden. This tells me they are either lazy or really optimistic.:)

I refer to those threads as an ambush (I really do).
You get someone posting code missing a semicolon, you tell them how to fix it, and they're sometimes like "by the way, here's 3000 lines of a library I'm rewriting from scratch, I don't know where the error is."

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Is it possible to automate the save as option, through c++?

Possible, possibly. You could write a macro in VBA that would dump the files into a directory which your C++ program could watch for changes. Weigh the effort you have to put in with your current knowledge against any time that you might save doing it this way.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

The quick and dirty way is to save them both out to text files (with Save As...) and go the getline route. The 07 and later .docx is XML based, but it's still a binary file, I believe.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Would a browser-based IRC client take up too much resources?

If you click the link I posted, it is a browser based client.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

I would say no, at least not evaluating them over the long term. Sometimes it takes longer for something to click with someone, but once they understand it, they're off. If people ask what might seem like stupid questions, they may be chipping away at it, but then suddenly understand it "better" than you do. Then there are the people that are lazy, and they might always be lazy. That's not always a guarantee either, since there are some people who really have gone through some s--- or don't have the time, etc.

However, your post makes me believe you aren't cut out to post in the Geeks' Lounge ;) My post says I spend far too much time here, procrastinating.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Please post their recommendation if they have one.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Which windowing library are you going to use?

I think Dev has the Win32 API included (good tutorial here http://www.winprog.org/tutorial/). You might be better off starting with another GUI option like Qt (which will come packaged with a newer version of g++ than you have with DevC++).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Somewhere between lines 11 and 21 add an fout<<endl; That should do the trick.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Adding this to local variable x

Right, because the variable at the local scope with the same name as the global one essentially "blocks" the global.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Nah, I'm kicking over tables and smashing bottles over this thread. ;)

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Yes, that's correct. Can you explain to yourself (and future generations) why?

frogboy77 commented: :) +1
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

Ok, OP. Now, what was your rationale for your answer?

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster
char status,type,colour,suburb;
char breed;
char age, phoneNo;

Char is only going to give you, well, a char. You need to make those arrays, too. Ballpark it, so if someone's pet's name is "fjdskljfskljflskjffsfsfd" (which is a great name) you only take the first 10 chars or so anyway. Hint, use getline.

Test to see if your char arrays are empty before writing "unknown". Since you are using char arrays, you'll need the functions in <cstring>.

Are you trying to append to your existing file that you've been reading from? Check and make sure there aren't excess newlines in the file at the end (open it in a text editor to see).

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

[Opinion]
Yes, as it stands it sounds like the OP wants a quick answer. If you have a means to check, check it. Then try to figure out why the answer is right or wrong. Then post.
[/Opinion]

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

There's a fantastic way to check the output of any source code ;)

Please explain your rationale for your answers, they are not correct.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

People in high school and college should always look into what is known as their VARK inclination (see for example http://www.vark-learn.com/english/index.asp -- a lot of the websites on the topic will be trying to sell you something, so be wary). Usually you take an inventory and you get scored to the extent that you are a visual, auditory, read-write (as it seems scarlettmoon is, at least partly ;)), and kinesthetic.

I tended to be a read/write learner, too. I does take a lot longer, but for me it was worth it. It's easy to get lost in the facts that way, so it ties into what I was mentioning above. Sometimes doing it by rote doesn't serve you the best for the particular course that you are in, so it helps to integrate sorting/rewriting those facts into concepts, which you can sort into ideas, theories, schools of though, etc.

jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster

For the first part, you'll have to use a global hook, see http://www.daniweb.com/software-development/cpp/threads/292475 and the related MSDN.

For the second part, check if certain values have been defined (an older thread, so I don't know if there are new versions):
http://social.msdn.microsoft.com/forums/en-US/vcgeneral/thread/3abd4c16-d412-4dbf-a958-eb3b8c05b4bf/