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

Here's your reply:
[boilerplate_help_info]

Posting requests for help must be well thought out if you want help quickly and correctly.  Your post did not meet the criteria for quality help. You may get some posts, but are they going to be useful?  Check your post with these checkpoints - what is it [i]you[/i] missed:
[list=1]
[*]Ask a question that can be answered. Do not ask
- What's wrong with my code?
- Why doesn't this work?
- Anything else that does not give us useful information.
[*]Post your code.  If we don't know what you did, how can we possibly help?
- Use [b]PROPER FORMATTING[/b] -- see this
- Use CODE Tags so your formatting is preserved.
If we can't follow your code, it's difficult to help. We don't care that you're still working on it. If you want us to read it, it must be readable
[*]Explain what the code is supposed to do.  If we don't know where the target is, how can we help you hit it?
[*]Explain what actually happened! If we don't know where the arrow went when you shot it, how can we tell what went wrong and how far from the target you are?
[*]If you have errors, post them! We can't see your screen.  We can't read your mind. You need to tell us what happened.
[*]Do [b]not[/b] ask for code. We are not a coding service. We will help you fix your code. 
    If anyone posts working code for you, …
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I don't seem to understand the difficulty. Can you do the task without using a function? If so, why would a function cause a problem?

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

That code didn't work for me so I modified it. This code will work for any situation that someone needs to use the up arrow, down arrow, left arrow, and right arrow.

It will? Try it on any Linux Compiler. Try it on any non-Borland/Microsoft compiler. It won't work in most of these situations which means it doesn't work.

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

Look up how the RETURN statement works.

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

but also the questions asked in the HR round of interview

I agree it's used to weed out candidate that can program. The answer to give the HR guy is "of what use is finding the greatest of two numbers without using comparison operators? Do you recommend using convoluted programming practices in the code created here?"

This response shows you are thinking of the employer and you'd rather write straight forward code than obfuscated code.

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

What is the best way to change the following program into functions?

Figure out what statements you need in the function and what values you need to pass in.
Replace those statements with a function call.
Copy the statements to the top or bottom of your program surrounded by the function header and footer.
Define the now local values that are used in the new function.
Test....

Can someone show me as a good programming style?

See this

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

In the 1st case, the first if is executed
nr-- updates the variable first and uses the updated value of nr to compute the condition

Here is the explanation...

Listen to irre. He's correct, you are not.

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

I really need help finishing this assignment. I am really confused.

With what? Just posting your completely unformatted code and telling us you're confused gives us nothing to help you with.

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

HI,

I recently joined the forums (today) and i would officially like to say hi.
HI

HI. Please don't use colors...

For my question:

Are there any books,websites or tutorials that use a moderate vocabulary that teach C++?

Didn't the post at the top about Books help?

Thanks for the help in advance. BTW is there a rules page?

Do you mean like the link at the top that says Member Rules? Let me look... :icon_wink:

When you read them, see if you can list the rules you already broke... :icon_mrgreen:

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

Create a loop to loop through each text box.
Set the 'current' text box TEXT value to the Random Number generated

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

for (i=second_letter; i<second_to_last_letter; i++)

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

deceptikon, that really was very very good :)
yes it worked.But I would like to know, what are the other things that make the code 'unclean'. Thanks once again. :)

Using gets() is a BIG unclean move. See this

Also, changing the value of a variable more than once in a statement, like x = (3 * --x) + x++; x is changed 3 times so there's no telling what the value will be for certain. See this

Those are the two that come up most often.

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

hi there

im wondering about the difference between:

When you wrote the test program to output the values, were you able to see what happened?

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

Look again at what I posted. cin>>command; does not read an entire line.

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

Store them in an array and when done output the array starting from the last input.

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

i am not getting understand either. Your statement makes no sense.

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

Of course. But what do you expect to gain from doing it?

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

I don't understand.
You need to convert an array of hex values that you output into an integer? Even though you input that integer in the first place? You question is quite confusing.

Maybe some details and definitions would help us make sense of your question.

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

Case expression should be a constant or an expression that reduces to a constant.

It surprises me that no one before you said anything even remotely like that! Oh wait...! Look at what L7QSR and deceptikonsaid... :icon_rolleyes:

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

Im writting a very simple command-line. I want the > Charecter to come up every time a command ha finished what it's doing (easy) AND when the user presses enter with nothing on it.

I guess it completely depends on your design of how your input works.

What I'd do is

  1. Output the prompt ">".
  2. Read an entire line.
  3. I'd then parse the command entered.
  4. Then execute the command if there is one.
  5. When done with all that, loop back to #1.
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Please PLEASE post the grade you get for handing in tungnk1993's work/suggestions. I'd really like to know your instructor's comments.

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

Still receives an error? We didn't know you had an error in the first place?

Your really need to learn to ask for help properly. The info you gave so far has been totally incomplete -- meaning we can't tell what's happening because you didn't tell us.

You need to read this, especially #1, #2, #4, #5:

[boilerplate_help_info]

Posting requests for help must be well thought out if you want help quickly and correctly.  Your post did not meet the criteria for quality help. You may get some posts, but are they going to be useful?  Check your post with these checkpoints - what is it [i]you[/i] missed:
[list=1]
[*]Ask a question that can be answered. Do not ask
- What's wrong with my code?
- Why doesn't this work?
- Anything else that does not give us useful information.
[*]Post your code.  If we don't know what you did, how can we possibly help?
- Use [b]PROPER FORMATTING[/b] -- see this
- Use CODE Tags so your formatting is preserved.
If we can't follow your code, it's difficult to help. We don't care that you're still working on it. If you want us to read it, it must be readable
[*]Explain what the code is supposed to do.  If we don't know where the target is, how can we help you hit it?
[*]Explain what actually happened! If we don't know where the arrow went when you shot it, how can we tell what went …
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Hey i guuys, i researched for this topic and there were some close titles to this but none exactly helped me.

I helped with (or at least followed) many of the prime number programs here. If memory serves, and it does, almost all will help you.

You have basically 2 things to do:
1) test a value for prime. Reread a few of those unhelpful threads and you'll learn how to figure out if a number is prime or not.
2) take that code and turn it into your function.

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

Ugh! I may need to ask for some examples.

Or you may need to post some code.

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

I'm simply implying that if you can find no random pivot information, it may not be possible.

What is the need to use random rather than the normal tried and tested techniques? If just for your own gratification, fine. If you need a sort for some project, use the tested techniques.

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

I read through all previous post regarding quicksort on a linked list. The trouble I am having is using a random element, it seems all the other post are using the first or middle element where I want to use a random element for the pivot.

You may want to, but have you seen any data/algorithm to support that it will work? There may be a reason you found no information about a random pivot element.

Stop looking at posts and look at actual algorithms with explanations. Learn how the sort works. Then you'll know if a random pivot is viable.

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

1. How important do you consider computer security?
Quite important

2. Do you use Anti‐virus/Anti‐spyware software?
i. When was the last time you updated this software?
ii. When was the last time you complete a full scan of your system?
This month.

3. which operating system do you consider most secure?
Don't know enough systems. Windows seems to be least secure.
And based on the hacking scuttlebutt, none seem to be secure.

I also note that only the PC market seems to be listed in these answers. I am including all OS flavors from IBM, SUN, DEC, etc... This is where most of the severe hacking comes from.

4. Do you use names, dates, or cities as your password?
No

g.have you been a victim of identity theft? if not do you take extra precautions so you do not?
No. Not really, just common sense.

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

[boilerplate_help_info]

Posting requests for help must be well thought out if you want help quickly and correctly.  Your post did not meet the criteria for quality help. You may get some posts, but are they going to be useful?  Check your post with these checkpoints - what is it [i]you[/i] missed:
[list=1]
[*]Ask a question that can be answered. Do not ask
- What's wrong with my code?
- Why doesn't this work?
- Anything else that does not give us useful information.
[*]Post your code.  If we don't know what you did, how can we possibly help?
- Use [b]PROPER FORMATTING[/b] -- see this
- Use CODE Tags so your formatting is preserved.
If we can't follow your code, it's difficult to help. We don't care that you're still working on it. If you want us to read it, it must be readable
[*]Explain what the code is supposed to do.  If we don't know where the target is, how can we help you hit it?
[*]Explain what actually happened! If we don't know where the arrow went when you shot it, how can we tell what went wrong and how far from the target you are?
[*]If you have errors, post them! We can't see your screen.  We can't read your mind. You need to tell us what happened.
[*]Do [b]not[/b] ask for code. We are not a coding service. We will help you fix your code. 
    If anyone posts working code for you, they are a …
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Hope past experience isn't the expectation...

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

Sorry, misread...

Have you tried testing the return statii of the I/O to see if there were errors? That's usually a good first step. You're just blindly assuming everything is working correctly -- and clearly it's not.

You also might want to shorten your test. Make a new data file with 88 records and change the IF to 10. When you get that working, go back to the full file.

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

STOP YELLING AT US! WE'RE SORRY! WE WON'T DO IT AGAIN!!!!

Read the friggin' Member Rules! And this:
[boilerplate_help_info]

Posting requests for help must be well thought out if you want help quickly and correctly.  Your post did not meet the criteria for quality help. You may get some posts, but are they going to be useful?  Check your post with these checkpoints - what is it [i]you[/i] missed:
[list=1]
[*]Ask a question that can be answered. Do not ask
- What's wrong with my code?
- Why doesn't this work?
- Anything else that does not give us useful information.
[*]Post your code.  If we don't know what you did, how can we possibly help?
- Use [b]PROPER FORMATTING[/b] -- see this
- Use CODE Tags so your formatting is preserved.
If we can't follow your code, it's difficult to help. We don't care that you're still working on it. If you want us to read it, it must be readable
[*]Explain what the code is supposed to do.  If we don't know where the target is, how can we help you hit it?
[*]Explain what actually happened! If we don't know where the arrow went when you shot it, how can we tell what went wrong and how far from the target you are?
[*]If you have errors, post them! We can't see your screen.  We can't read your mind. You need to tell us what happened.
[*]Do [b]not[/b] ask for code. We are not a …
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

The site hasn't been skinned yet, so it doesn't look like much. We don't really want to show off the raw site as folks have a tendency to focus on how it looks and ignore how it works.

Not the moderators (at least most of us are savvy enough to understand that)

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

What did the NotePad's HELP say about the RUN option.

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

See this, this, and this.
Oh this, too.

DJSAN10 commented: Nice work WaltP :) +5
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

You got neg rep from me because you are telling a student uncomfortable with
1) programming -- he's NEW!!
2) English -- he's from Malaysia
to create a GUI app. He just want's to know how to ask a question again when an improper answer was entered, not to take over the screen and bounce all around it!
Sheesh! :icon_rolleyes:

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

You are making it so hard! The instructions are:

Write a program that takes integer input from the user and store into the array dynamically allocated each time a new element is added.

Note the wording: "store into the array dynamically allocated ".
Allocate a buffer of sufficient size -- once.
There is nothing in the instructions that says allocate a new buffer for each and every integer.

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

You can't open and close a file between each write and expect to keep the data being overwritten.
Move the write outside the IF.

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

[boilerplate_help_info]

Posting requests for help must be well thought out if you want help quickly and correctly.  Your post did not meet the criteria for quality help. You may get some posts, but are they going to be useful?  Check your post with these checkpoints - what is it [i]you[/i] missed:
[list=1]
[*]Ask a question that can be answered. Do not ask
- What's wrong with my code?
- Why doesn't this work?
- Anything else that does not give us useful information.
[*]Post your code.  If we don't know what you did, how can we possibly help?
- Use [b]PROPER FORMATTING[/b] -- see this
- Use CODE Tags so your formatting is preserved.
If we can't follow your code, it's difficult to help. We don't care that you're still working on it. If you want us to read it, it must be readable
[*]Explain what the code is supposed to do.  If we don't know where the target is, how can we help you hit it?
[*]Explain what actually happened! If we don't know where the arrow went when you shot it, how can we tell what went wrong and how far from the target you are?
[*]If you have errors, post them! We can't see your screen.  We can't read your mind. You need to tell us what happened.
[*]Do [b]not[/b] ask for code. We are not a coding service. We will help you fix your code. 
    If anyone posts working code for you, they are a …
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Uninitialized variables
Program runs in the same memory
Programmer did something wrong

These are my guesses...

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

After staring at my book for an hour I was able to come up with something new. Here is the new string I wrote, I really think I am over analyzing this. Anyways I cannot get this string below to work properly either. Thanks for all the help so far, I just must be having the ultimate brain fart.

No, you're not having a brain fart. You're posting questions, getting answers, and completely ignoring the answers.

I'm done here.

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

But i am new bie in c++.

Based on the above statement you made, the easiest is the file. All others are much more complex and not appropriate for the "new bie"

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

Save the output from a.cpp in a file.
b.cpp reads the file.

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

Food for thought:
How many cards in a deck?
How many cards in a suit?
How many cards of a rank? (same pips)

Can you see a correlation between all these numbers?
Are the following mathematical operators useful in calculating these numbers? * / %

You can make the job easier by thinking through these questions and coming up with a new representation of your deck.

Next:
Once you deal a card, as Moschops suggests, you need to remove the card from the deck or mark it as used.

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

Okay. Here is what I currently got so-far:

...snipped...

Their is no errors.

With the code posted, there (note the spelling) is nothing for us to help with -- code-wise.

BUT how do I do it like what the assignment says???

1) By thinking about the problem, coming up with questions that need to be answered, answering the questions,
2) understanding the project
3) designing a solution based on your understanding,
4) programming based on the solution,
5) killing any bugs because you missed something in the design.

I know I am required to use 2D arrays and 3+ functions.

How many arrays do you think you need?
What would you use them for?
This is part of the design...

What does the program as a whole need to do -- from start to finish?
What steps can be logically done by functions?
Another part of the design.

Conway's Game of Life

For this assignment your are to write a program, that plays Conway's game of Life. See the Wikipedia definition, if
you have never played the game: http://en.wikipedia.org/wiki/Conway's_Game_of_Life.

Here is how our implementation will work:
(1) The program will ask the user to enter a filename from the console. (Just like the last assignment).
(2) The initial configuration will be read in from a file, which will be a 12 by 30 two-dimensional array of characters. The game board will be surrounded by all …

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

I am having trouble with a couple of things: first, using a function and/or loop to keep track of rolls to display them at the end of the program. I think I should use a static int variable but I am not sure how to initiate this using functions (which function to put the variable in?).

Why? What does static do for you?
If you want to "keep track of rolls", you need to keep track of them. All you are doing is generating a roll, outputting it, and throwing it away. What do you need to use to 'remember' each roll?

Secondly, I am having difficulty with using a loop to display the final results. Since the expected value is different for each point value, I can't use a constant to do the calculation.... not sure how else to do this (currently I just have some variables I've put in for filler to help me see how the output will look like when it's done).

What calculation? From the description you don't need to calculate much of anything except the expected information. What algorithm do you have for calculating the expected values?

Also, I can't figure out how to pass the value of repetitions to the ShowValue function without using it as a global variable... I have tried looking this up (call by value/reference) but seem to be having difficulty transferring the concepts to my own code.

Pass it as a parameter to the function. What …

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

Just make the password a character array.

jember commented: you didn't even explain the whole thing. -1
zeroliken commented: to negate the downvote +8
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Keep a counter of how many houses you placed in the array.

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

Oh, poorly worded description caused a misread.

Set a SPACEflag to false (none seen)
while not end-of-string
    read character
    if character = SPACE       (this char is a SPACE)
        if SPACEflag is false  (last character was not a SPACE)
            SPACEflag = true   (flag this space)
            store character    (store this SPACE)
        endif
    else
        SPACEflag = false      (it's not a SPACE)
        store character  
    endif
end while