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

Any particular reason why this isn't good enough?

Probably because loops are still too hard and recursion is taught two classes beyond this one? Remember, just because you understand recursion and vectors and all that high level stuff does not mean someone in their first class has ever even heard of them, let alone been taught it.
8-]

so if the first element of the array does not equal the second element then the contents of what Walker is pointing to gets assigned the first array element. Walker is then plus plused so that the next time array[i] != array[j] we don't replace the the same thing in Walker over and over again. usize is simply used for output reasons, we need to know how big the new dynamic array is so that we can output it correctly.

Yeah, that's what it does all right. I still have absolutely no idea what Walker is for but getting loaded with a bunch of letters.

Try outputting Walker after each loop and see if it contains what you expect. In fact, after the first loop do you even know what should be in Walker???

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

I don't really understand what's wrong with my format.

You're kidding, right? You see nothing wrong with

    variable = change *
100;                                                     
    quarters = variable /
25;                                                    
    variable = variable %
25;                                                    
    dimes = variable /
10;                                                       
    variable = variable %
10;                                                    
    nickels = variable /
5;                                                      
    pennies = variable %
5;                                                      

????

How would I test the outputs? I tried adding in cout << "\ntest: " << coinname << "\n"; replacing coinname with the proper variable.

And what did outputting variable after the line
variable = change * 100;
show you?

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

Where are you going to press "X"? What variable will get it?

I am playing against the computer and this is the beginning. my main question is on the loop and the randomness. I need the program to keep going and show score after every 3 times and the user can quit the game when ever they want by typing X instead of the number to select.

There are no questions in that question. Only your needs. You need to explain what your problem is, not the assignment's problem.

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

Then regardless of whether or not the forst and second elements of the array are equal the i and j gets plus plused. I hope it makes sense.

No. All you did was say "it does 'this'". What does each and every line do and why? A comment like
Walker++; // increment Walker
is not acceptable. Why are you incrementing Walker? What's it's purpose?

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

You figured correctly. By multiplying by 100 you have eliminated most of the problems floating point values will cause.

By the way, when making a post, it is OK to actually view it to see how it looks and modify the post so it's readable. Just sayin'. I was going to ignore it because of the crappy format.

Try outputting the values at key spots to make sure you are generating the correct values and variable is correct each step of the way.

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

Look up the methods in the string class. The methods for searching, splitting, and all that stuff are well documented.

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

You can't increment constant values. That's why they are const

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

Please explain this loop. It doesn't make any sense to me.

for (int i = 0; i < size; i++)
{
    for (int j = i + 1; j < size; j++)
    {
        if (array[i] != array[j])
        {
            *Walker = array [i];
            Walker++;
            usize++;
        }
        i++;
        j--;
    }
}

And please explain IN DETAIL. Don just say it does 'this'

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

Take it a step at a time...

How would you generate 6 digits from name and animal and 2 from birthdate?

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

And what problem are you having?

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

You made a a Windows project, not a Console project.

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

yeah, goto! Or recursion!

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

Look for the biggest number.

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

What is *x? How is it related to i? Or how it i related to *x?

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

You can't just cout << array and expect anything to happen. An array is a collection of items. You have to output each item.

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

How to make a program that prints out 10 stars with using cout or for loops or while loops.

Nothing said about do-while... ;-)

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

Or even putchar which makes even more sense.
How about write to stdout?
Maybe even write directly to screen memory. That's a neat way.
ಠ_ಠ

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

Sure.

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

I would encourge a complete description of your qestion, with understandable examples. I for one am confused by your question.

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

Since your description is quite vague, we don't really know what to look for.
Since all switches break, I don't understand what you're describing.

All I can suggest is make sure your methods are correct.

By the way, the statement
list[N] = (rand()%10000)+100; // Random number of 100 <= N <= 10,000
gives random numbers from 100 to 10099

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

1) If they give you the same value they are defined the same.
2) If they are not supposed to be the same you did something wrong that gave the same value.
3) If you load the same value into a double and a long double, why would you expect 2 different values?

In other words, given your extremely vague description, any answer is possible.

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

Since I don't feel like trying to understand exactly how your program works, here's a general explanation:

Assuming you are pointing at your first node, and START points at the first node:

Get the NEXT pointer.
Load START with that pointer.
Delete the current node.
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Depends.

What is your concept?
How do you process each of the commands in your description?

When programming, you can't just start throwing code into your file. You have to make many decisions before you code anything.

Case in point, After reading your description and making my first post, I decided this was interesting enough to try to do. In an hour I had a working program -- by following my 'design' outlined above. Granted, I've been doing this for years, but the point is I started with a design.

Since you didn't seem to like anything in what I suggested (you didn't use any of my ideas at all), you'll need to explain (design) your program given the concept you listed in your first post.

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

Include the file name.p (a text file) that's in the name directory into the code.

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

If you're worried about it, don't do it.

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

My compiler gives no error doing this but looking around the web I see many articles saying I should be using the new and delete commands to allocate arrays dynamically. My main question is if this is ok to do? Or will I run into problems in the future.

Being able to declare an array based on an input value is new to C++ so it really depends on what compiler you are using and which ones you use in the future. Some have that capability now, others don't.

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 you missed:

  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.
  2. Post your code. If we don't know what you did, how can we possibly help?
    -Use PROPER FORMATTING -- 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.
  3. Explain what the code is supposed to do. If we don't know where the target is, how can we help you hit it?
  4. 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?
  5. 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.
  6. Do not 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

What's it do? Why did you post it? Are we supposed to be impressed or something?

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

Given the lack of info in the description, I assume the program is menu driven. In other words, you just execute the menu commands after initialization in this order:

arrivals?
add
add
arrivals?
full?
check
add
add
full?
check

Is that about it?

I need some help getting started here. This is what I have written so far, can anyone point me in the right direction on this one?

It's obvious. Start writing the functions specified in the description.
In main(), test these functions as you write them.

You might want to start with a
1) the initialize method
2) print method to display all the current planes (useful for debugging)
3) add method so you can add the planes
Then test the above until they work.

Now start adding all the other functions.

bool isFull(const Airport &airport);
Why pass in the Airport? The method is part of the Airport definition. Therefore bool isFull(void); is an appropriate definition.

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

Time for a Moderator to weigh in. I'm raising my hand.

Gonbe: Do NOT give full working answers to questions. Guide them to writing their own solutions.

Gonbe: If you've ever gone to school you'd know that partially you do get provided examples of good practices. Generally these are subsets of bigger problems that have to be solved later but they can sometimes be a larger example too as these introduce additional complications.

You are proving our point. Notice your own wording: "examples of good practices" and "Generally these are subsets of bigger problems". How is your code an example or a subset. Isn't it full, working, hand-in code? Even by your definition it's wrong.

Gonbe: Regarding your 'point' directly, I do think YOU don't understand the purpose of homework. More precisely, you don't understand the role of these forums.

After 19 posts you know more about these forums than the rest of us? Hmmm, sounds like a bit of self-deluded arrogance to me. What makes you such an expert suddenly?

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

Of course not.

* and / are by definition a higher precidence that + and -

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

What you are trying to do is not trivial. You need to look at the equation as a whole, not search for small parts and process piecemeal.

It might be useful to study up on Reverse Polish notation to break up the equation into individual atoms.

You can use a structure to store the atoms which would contain

1) type (whether this is an operator or a number)
Values here could be 1 for a number, -1 for an operator.

2) value (a number from the equation or a code for the operation)
Each operator (+ - * sqrt mod) has a unique value. Consider that there are operators that handle two values (* - / mod) and others that handle one (- sqrt pow).

Alternatively:

Copy the equation. 
Search for the thing you want to process.
Get the values to process.
Do the subequation.
Replace that section with the answer.  

Everything stays in the string. So if you have
10 * sqrt 25 + 3
and you want to process the sqrt, grab the sqrt 25 and replace it:

10 * sqrt 25 + 3 -- becomes
10 *       5 + 3

Note the spacing. The entire section sqrt 25 gets replaced by SPACEs and a 5.

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

So what's not working right? How can you tell?

when asking for help, you must tell us what's going on, not just say "it doesn't work". There are hundreds of ways it can fail. Which one is yours?

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

When you input, is the ENTER you press added to the end of the string? Better check.

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

I appreciate that you are one of the very few people that comment the code but
1) your excessively long lines with comments make your logic hard to follow
2) most of your comments are meaningless.

For example:

using namespace std; // Declares that we will be using the namespace library.
Relatively obvious...

-------------

int main() // The beginning of where the C++ program
Also obvious...

-------------

    // Variables declared
    int ncol;
    double poweroftwo;
    char letter;

Yeah, so? A description of the variables would be much more useful

-------------

// Main Do-while loop (nonstop)
do

Why do you nead a main do-while loop that's nonstop?

-------------

{        while(1); //We make it infinite, only close at the break 

Didn't you already say this at the "do"?

Comments are supposed to help the reader understand what you wrote and why, not just regurgitate the bleeding obvious. What's the reason you use the statements? How does it help you get to your final solution?

And why use an infinite do-while? An infinite while makes more sense because you know immediately it's an infinite loop, so your comment can be used to inform the reader of something useful.

I have no real idea what you are trying to accomplish. Your comments seem to indicate you input a number and output the letters in that many columns. If so, where in the output loop do you test if you've output enough columns and start …

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

See comments:

  while(!(cat1->Empty()))
  {
        // process queue 1
  }

  if(cat1->Empty())    // Didn't you just empty queue 1? 
  {                    // Why do you need to test if it's empty?
     while(!(cat2->Empty()))
     {
        // process queue 2
     }
  }

I don't see a definition for nullptr. Did you define it to be FALSE or 0? Or is it a C++ definition that you are assuming to be FALSE/0?

Output values at key places in the code to see if the values are correct and the code is making the decisions you expect.

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

Why did you start a NEW thread? And why did you ignore this help?

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

return rand()%1000000+10000;

What is the maximum value rand() will return?
What is the remainder of that value and %1000000 ?

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

// I cant figure it out the total corporate sales, and the member function for quartely on each division ***

And we can't figure out how the program flows with no formatting at all. It is extremely important to format your code if you want others to read it.

Case in point, I can't find your attempt at total corporae sales at all. It's hidden somewhere in there, I'm sure.

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

You caluclate the remainder.
You push the remainder on the stack.
You convert the remainder to a letter.
What do you print? Is it the value on the stack or the one you converted?

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

Line 74 is an open brace in void mainscreen().

You obviously haven't learned how to format your code yet. Please take a look at this and format your code properly so it can be followed. Many errors can be found in seconds with properly formatted code.

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

Gee. Sorry to hear that. Maybe it's on line 38. That looks suspicious.

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

Kool. Let us know how it goes...

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

NathanOliver: Im surprised I havent seen him yet.

Surprise!!!!

deceptikon: Hmm, does this mean that Walt is the new Narue? Before it was always Narue's sharp tongue that everyone feared. ;)

Nyahhhh, I just didn't get logged in for a while. I thought it was 48 hour befor you were missing...

NathanOliver: Im pretty sure Walt would tell you this but you should use meaningful titles for your threads. Asking for a specific person to check out your code doesnt really say anything about what is going on.

Absolutely...

deceptikon: You realize that by calling out Walt, you've guaranteed that he'll blast you for not using any formatting and for unnecessarily living in the 90s with Turbo C++, right?

Formatting, yes. That was my first thought. As for Turbo, I really don't care with half the world stuck in the 80's. It's others that go ballistic over Turbo. I personally like Borland. I can carry it with me.

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

What about short bodies of code? If we want to explain a problem with a couple lines it's useful to quote those lines.

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

Every time you go throught the loop when k equals i-1 you have a match.
Start the i loop at k+1 and get rid of the +1 elsewhere in that section.

Also, the standard way to do loops is
if you defined the array as A[20], your loop is set up as:
for (i=0; i<20; i++)

It gets very confusing if you mix <= and => and +1s and all that stuff.

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

Nope. Don't want to.

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

If you had

string studentName;
int grade

not in a structure, how would you do it?

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

See my previous post and do what I ask. I claim you are not testing the lab. Prove me wrong instead and show me (don't tell, show) exactly how you are testing and why it works.