WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Oh.... No I was confusing them with he .obj files I've dealt with since the 70's -- output from compilers. .O is only Linux, .OBJ was every other system I've used.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I always thought language was an evolving and growing thing.

In the 30's, the proper word was clew until the magazine Clue was started and the 'wrong' spelling became accepted.

Until computers became popular, input wasn't a word.

Years ago, gay meant happy.

Only recently, DOH became a word in the dictionary.

IMAO, infraction is used perfectly well for the evolving language we are currently involved with.
(which used to be bad English but is no longer -- prepositionally speaking)

Nick Evan commented: Here he comes to save the day! +0
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

They won't click the link. They don't care. Remove the Code Snippet option if there are fewer than 20 posts.

jonsca commented: It would save me from having to come up with "clever" ways to report ones that aren't code snippets! +0
Ancient Dragon commented: Good idea :) +0
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

If you'd format your code I'd be happy to take a look at it. As it is, I'm not going to struggle with it.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

i have written this code but it isnt working properly...... plz check it

Check it for what? Are we looking for something? I don't understand whay you need us to 'check it' for.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Hi

we have a buffer say char array.[1].so the size will be 1 byte.

Why? An array is multiple bytes. 1 byte is a byte, not an array.

I have a fleet of cars -- it's a Ford.
I have a pride of lions -- his name is Leo
I have a pair of socks -- where's the other pair for my left foot.

jephthah commented: jesus christ, it's a lion get in the car!!! +7
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

wow, 123 views, no response, wow...

No response? Really? What about

Do You Have any idea on how a vector works?

It seems the no response was on your end, bucko.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Write a boolean truth table for while ( ans != 'n' || ans != 'N' );

jephthah commented: heh. +7
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Learn to format your code properly and the error will be readily apparent.

After that, if you need more help, you need to tell us what's wrong. We didn't write the code, you did. Explain.

tux4life commented: Exactly :) +8
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

You've been asked before to use proper formatting. Your code is an absolute mess. Please format your code properly so we can see the flow.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

btw, you guys wouldn't have any book recommendations would you?

No... We don't recommend books. Oh, and ignore that post at the top of the forum titled "Read Me: C++ Books" :)

Ancient Dragon commented: LOL +28
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

OK. I did it. Where do I send it to get graded?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Nope, this came out Apr 14 or so.

Close enough for government work.... :icon_wink:

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

And I said format your code. I see what you did and can't read it. Therefore I can't help solve anything.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Please format your code. Whatever problem you are having can probably be attributed to the fact you can't see what you're doing.

See this

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I've just read a few books on C++ and learned a lot about the language, but the books never mentioned how to add sound and visuals to my programs.

That's because C++ doesn't actually do graphics or audio. It's simply a programming language.

I "think" that stuff is all stored in libraries, but...

Very true. You find the libraries you want to use and add it to your C++ programming environment. Then you have graphics capability.

what tutorial should I read next to learn how to implement graphics/sound into my programs?

This I can't help with. But someone will come along with some good advice (and others with bad -- hope you can tell the difference :icon_wink:)

Also, I do just use a library right? or is it relatively easy to write my own graphics/sound library?

It is very difficult to write your own libraries. Stick with a good package that comes well recommended.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

i want to make this game....and i need help....in the game computer should play as a second player....and it should also win....is that possible....and is it easy???

Yes. Except for the win part.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

C++ has nothing to do with making Windows. It barely knows about the console and keyboard. All that windowing stuff is system dependent and C++ simply taps into that system substructure either via API calls, add-on Windowing systems like MFC, OWL, FLTK, and others.

So you need to research the GUI techniques and choose a GUI System to learn. I hear FLTK is good, and fairly easy.

Salem commented: Nice +20
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I do not know why every post that i put...there are always controversies..maybe my question was ambiguous..

The more details you give -- with examples, restrictions, and when/where/what, the less ambiguous your question. Remember, only you know what you're doing. If you don't explain it to us well enough, controversy happens.

jephthah commented: controversy! woot! +7
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I've noticed every time someone claims they have an easy or quick question, you can count on a minimum of a week or two of struggle to get the problem figured out.

If it was so easy, why do you have to ask? :icon_wink:

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Use some of the programs you had to write when you learned C++.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

How to copy one 2D-array to another without using loops and library function of C. Not pointers.

No C function? Write it in ForTran, or Algol, or Pascal, or Cobol.
Bliss would be interesting, or Lisp.
It would be hard in RPG-II.
Maybe assembler -- no, there you'd need a loop.

jonsca commented: Programming language "historian" rep +4
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

if(tempch>=65 && tempch<=90) tempch+=32; if(str[count]>96 && str[count]<123) What are these magic numbers?

After all that discussion since last night about using the characters themselves ('A', 'z', ' ') you still post code with magic numbers?

Seems AD and J just wasted a night trying to help.

But still it's not working....
here's the new code:

So still the exact same problem? You fixed nothing with all that from last night? Or is this a new problem?

You know, looking back on your posts you love to tell us "it's not working" but you like to keep what's actually happening a secret. Don't keep secrets! Don't tell us it's not working. We figured that's why you're here. What we care about is what exactly it is doing wrong. Exactly. Not a vague "it's broke". A specific "it does this and this instead of that and that". Please be detailed.

Ancient Dragon commented: Yes, I may as well have ignored this thread. +27
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

you don't need a compiler on every computer. Just the .EXE file if it's a console program.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

If you are trying to learn C++ why are you concerned with making a C program?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Your get_days_in_month() has a major problem.
You malloc() the day array but never free it, creating a memory leak. You'd be better off just creating the array as a pointer in the main() function.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

You can't use a string object with strcmp() . 2 solutions:
1) use the compare method that's part of the string object
2) convert the string object to char* with stringname.c_str()

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I need help figuring out why it doesn't work haha.

then tell us what it does wrong, haha. We aren't psychic, chortle.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Changing it to use a human player simply means that any information that the computer player generates must come from the keyboard.

Where in the code do you generate the data for a player's move? Take that code and put an IF (player == computer) statement around it. Then make an else to accept input from the user.

Be sure to make a variable to keep track of the type of player, or make, say, player 1 always be the human. Change the IF accordingly.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

When you write to 'buffered' device, sometimes the system will hold the characters in the buffer until a specific thing happens:
1) the buffer is filled
2) a NEWLINE \n is added
3) an explicit command (flush) is used
It all depends on how the compiler I/O is designed.
So on some compilers, a printf() or cout command may not work immediately. Therefore, you flush the buffer when you need the output right away.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Threads should remain open as a rule of thumb, and there should be no rule/movement against contributing to those threads at any time provided that contribution is on topic and adds something worthy to the thread in question.

Where the addition is spam/hijack etc then it gets dealt with using existing moderator processes.

Define etc. Does etc include "Me too", "Good code", "Thanks" resurrections, or are they part of the "adds something worthy" form of reply?

jephthah points out, another level of questionable resurrections. In some cases, a post that supplants previously good code with crap. Are they also "worthy" simply because they tried to help?

Here is my biggest complaint. Dani states she wants 'black and white' rules. You can't have b&w rules. What mods need are workable guidelines. If a resurrection doesn't add worth to the thread, what options can we choose from? And yes, sometimes worth is subjective. How do we decide?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

And please fix your indentation! It's very hard to read.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Jeez! if (false) is always false because false is -- wait for it -- false!

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I've seen those, the only problem is I don't truly understand them so I don't know what is going on. Like I said, new to C++, maybe 3 months under my belt? I can simply rip an algorithm from somewhere and add my "filler" but then I have no clue what it actually does... ya know?

Yea, I know. And knowing the Bubble Sort has nothing to do with C++. I had to learn the bubble sort years before there was even a C language.

You should study the bubble sort
1) copy working code for sorting numbers instead
2) write down 4 random numbers for an array
3) run the code by hand (not on the computer)
4) write down every change to every variable on every line.

That will go a long way toward understanding. You could also find an explanation of the bubble sort and read it. That'll help too.

jonsca commented: Was that on the Whirlwind? +4
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Do you mind if i PM you some code (not for a homework answer...)?

Against the rules... And it helps no one else. We are not a personal tutor service.

How can i convert this to binary, or even treat any number in c as binary to use bit operations on them (like 1<<y).

It already is binary. Everything in a computer is binary. Only the output is converted to a human-readable format.

if you have an integer with the value 65 and output it as:
Decimal you get 65
Hex you get 41
Octal you get 61
Binary you get 01000001
Character you get A

Once you grasp this concept you will be ready for the next step.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Dis iz error: U dint explan nutin. U writ 2 mch cde an dnt tst it. Plzzzz expln wat prblm iz. We dun unrstnd prblm. && U dint spk English. Cnt unrstnd not English

Fbody commented: Nice :D +1
jonsca commented: Yes +4
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

also, facesInhand[numberInHand2][13] is beyond the array. The array stops at 12, not 13.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

From the list of active threads (like here) click on the yellow Start New thread button.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

user_book[count].bn[temp][4] is a single character. Change it to user_book[count].bn[temp]

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

It's identical to what you've found. The data just comes from somewhere other than the keyboard. So the data input is a little different, all the rest is the same.

Salem commented: Yes +20
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I'd search Google rather than searching forums. There's more detailed information there.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

And format your code. It's very difficult to follow.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Every time you use an input statement, you should be checking the return status. Therefore, you should have no problem unless your input file is hosed.

What's the difference between while(infile.good()) and while(!infile.eof()) ? Aren't they (in this context) the same test?

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

EOF means end of file. You can check for it like this:

while(!infile.eof())

You could, but it's not recommended unless you are verrrrrry careful. Here's why.

(feof() and .eof() operate identically)

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

It creates a leak...

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

What J is trying to say with his "I know more than you" attitude is there are many NEW compilers that are available free and since the last Turbo compiler is 20 years old you should consider an updated compiler -- still free. That way you can concentrate on Standard concepts and not teach things that are not available in the industry.

jephthah commented: LOL you always make an effort to insult me, even while agreeing with me. I'm flattered that i affect you so deeply. :hugs: +0
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

@WaltP...i was just trying to help and he already wrote the program himself, i just showed him where he did wrong... i think there was no need to give me a negative feedback....just my two cents...:icon_neutral:

No you didn't. You never pointed showed him his error. You simply posted (allegedly) working code with the statement

well...none of you gave the solution..so i'm giving it...correct me if i'm wrong...

you state yourself you are giving the solution. Also, he never responded so you have no idea if he ever got correct code.

And you did ask to be corrected if you were wrong -- I corrected you.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

First thing is var is a reserved word. Don't use it as a variable.
Second, you went to the trouble making IsEvenNumber() but you don't call it.

WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

And you want us to do it for you?

That's not what we do here. You write it, and we help you fix it.