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

I actually have Turbo 1.1 on my machine. No problems...

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

Min and Max complete but still no luck for us on the total unfortunately

Does this mean you can find the min and max of the numbers by searching the list? So what's so hard about adding the numbers together to get a total as you search for min/max?

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

And watch your
titles
and your CODE tags

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

Here's a cleaner version:

int max(int a, int b)
{
  if(a > b)
    return a;
  else
    return b;
}

Except multiple returns from a single function is frowned upon. Best to keep your original function with the return changes mentioned above, and with one other minor change:

if (x >= y) 
{       // find the maximum number
    max = x;
}
else
{
//    (x <= y);    remove this line, it does nothing
    max = y;
}
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I believe the function you posted cannot be a method in playerType because you can't loop through multiple instances of the of the players from a individual instance. You have to loop through the players and call the method on each one individually - which makes your method much simpler. Remove the loop and simply pass back the bool (don't output in the method -- do the output after it returns).

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

Or you could put something like
system("pause");
just before the return 0;

Salem! How could you!?!?!

Use getchar()

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

Shamu

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

Cool it, guys. This is a 'Desktop' thread, not a 'pirated software' thread. Start a new thread if you want to discuss pirating issues.

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

isnt pound lb?

thats what we say if we go to the butchers and ask for x pounds of meat

Yes. pound, lb, # all mean the same think. Like television, TV and telly. Or elevator, lift, and that little room that goes up and down and makes me "blow chunks"*

*or
Hurl
Tossing Your Cookies
Calling for Ralph
Technicolor Yawn
Pavement Pizza
Praying to the Porcelain God
Driving the Porcelain Bus
Burping in 3-D

See, lots of different ways ... erp ... to express ... erppp ... 'scuse me....

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

land on planets

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

Please read this section of the Forum Rules. I suppose you should probably read all the sections, actually. ;)

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

And when you strcpy(String, "abcdefghijklmnopqrstuvxyz") ; into a 26 character array like this you just blew past your array bounds because a 27th character (\0) is loaded too. Remember, a string in C always ends in \0 and that must be accounted for in the buffer.

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

That still looks like C++ to me.

Use to scanf or gets to input data
If using gets, use atoi to convert a string of digits to an integer
Use printf to output the result.

Never ever use gets() for input. Here's why
Rarely ever use scanf() . Here's a series about why
Both links give alternate safe solutions.

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

You need 3 coin arrays:
A) The best coin solution so far
B) The last permutation of the coin solutions
C) The next (working) permutation being calculated.

1) First solution (A) is your initial run with 2 twonies.
2) Load that solution also into (B).

3) Load the next permutation based on (B) into (C) 
4) Load (B) with (C) for the next permutation. 
5) If (C) yields a better solution, replace (A). 
6) Generate next permutation at step #3
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Jeez! Stop shooting in the dark and think about the problem. First, format the code properly with braces and spaces so it can be read, then:

void populate(int array[][col], int row_size, int col_size)
{
    int x, y;
    for (int i=0; i <= row_size; i++)  // This loop just blew your array   
                                       //    boundaries. Take it back to <
    {
        for (int j=0; j <= col_size; j++)  // Same here
        {
            array[i][j] = 0;
        }
    }            
//  srand(time(NULL) * rand());  // don't multiply by rand -- does nothing
    srand(time(NULL));
    for (int i=0; i < max_total; i++) 
    {
        do              // start a loop
        {
            x= rand() % row_size;
            y = rand() % col_size;
        } while (array[x][y] != 0); // keep looping (get new coordinates) 
                                    //   if the location is already filled
        array[x][y] = id;
    }/*endfor*/
}

In the above code, I changed the for loops to have a "<=" that may fixed the problem. Keep the coutLoc for loop "<=" suggestion set along with this one, and let me know.

Looping 1 extra time is not a solution for data collisions. What if you had 2 collisions before the extra loop? You'll be missing one value. What if you had no collisions before the extra loop? You'd have too many values.

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

explode into billions

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

Sense the Force...

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

gland

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

Present, and Past

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

why is the # key called the pound key?

i call it the hash key as thats what telephone voicemail services tell you it is.

is the # really called pound in the USA?

Yes, it's pound in the States. # is the symbol used for a pound weight. For example -- 2# of flour.
And the phones really do say "press the pound key."

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

How to Bathe a Cat

1. Thoroughly clean the toilet.

2. Add the required amount of shampoo to the toilet water, and have both lids lifted.

3. Obtain the cat and soothe him while you carry him towards the bathroom.

4. In one smooth movement, put the cat in the toilet and close both lids (you may need to stand on the lid so that he cannot escape). CAUTION: Do not get any part of your body too close to the edge, as his paws will be reaching out for any purchase they can find.

5. The cat will self-agitate and make ample suds. Never mind the noises that come from your toilet, the cat is actually enjoying this.

6. Flush the toilet three or four times. This provides a "powerwash" and "rinse" which I have found to be quite effective.

7. Have someone open the door to the outside and ensure that there are no people between the toilet and the outside door.

8. Stand behind the toilet as far as you can, and quickly lift both lids.

9. The now-clean cat will rocket out of the toilet, and run outside where he will dry himself. Cat will return when hungry.

Sincerely,
The Dog

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

Please read this section of the Forum Rules. I suppose you should probably read all the sections, actually. ;)

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

Please read this section of the Forum Rules. I suppose you should probably read all the sections, actually. ;)

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

Yep, it looks perfect to me -- at least what you posted is perfect.

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

The code you posted seems to work fine for me... I get

Please enter the amount of money you would like changed: 4.63
2 Twonie(s)
0 Jonnie(s)
0 Loonie(s)
2 Quarter(s)
1 Dimes
0 Nickel(s)
3 Penny(ies)

thats:
4.00  2 Twonie(s)
      0 Jonnie(s)
      0 Loonie(s)
 .50  2 Quarter(s)
 .10  1 Dimes
      0 Nickel(s)
 .03  3 Penny(ies)
-----
4.63
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Walt, when I'm using for loops, my C++ compiler allows me to declare and initialize a variable within a for loop.

In C++, this is allowed:

int main(void)
{
    int i;
    i = 23;
    int j;
    j = i * 3;
    for (int k=1; k < 10; k+=2)
    {
        int newval;
 . . .

In C the above is not and should be changed to

int main(void)
{
    int i;
    int j;
    int k;

    i = 23;
    j = i * 3;
    for (k=1; k < 10; k+=2)
    {
        int newval;
 . . .

The variable declarations must be made before any executable code. This includes function calls.

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

i think the backtick is called the tilde. dont have a clue about the other ones, you only ever really need them for command line stuff

` is called an accent grave (pronounced gr-ah-ve not gr-ay-ve)
~ is the tilde
Top symbol is not, on a webpage it's the symbol &not
I've seen the symbol on the next key but also haven't a clue what it is.

And they are not there for command line, they are there for typing.

hey does anyone know what point there is on having an fn key ona desktop keyboard?

For one, it can be used to control a device connected to the computer. In one instance I know, Fn-F8 will turn on the overhead projector in a meeting/class room.

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

Peace is spelled p-i-e-c-e when talking about pie.

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

clomp

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

the Senate Hearings

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

I got a more than a little errors most of them say something like

error C2143: syntax error : missing ';' before 'type'

I wonder if this is because The function is located in a separate C file

No, it's because your syntax is wrong.

Steps to correct:
#1) Look at the error
#2) Figure out what it's telling you
#3) Look at the line number it mentions
#4) Look at the actual line in the code, and a couple lines above it
#5) Figure out what your code says based on the error

And if you can't quite see the problem, post the exact error here and about 5 lines above and below the line in error -- with a comment on the line that's wrong at least mentioning the line number, or "error here".

The reason I mention exact is if you don't understand the error, you can't very well paraphrase the error

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

Don't new people bother looking at dates? This thread is only 3 years old... :eek:

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

And more using global variables is not a good idea, because of the above reasons. The value of the variable can be changes outside the function.

Why use array only for using a single element in an array. You could have just declared a single int variable.

ssharish2005

Maybe because he's testing... ;)

During development a good programmer always writes test code and uses the same structures he's going to use in the finished program to make sure the concepts work.

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

wow... that was incredibly mean.

Wasn't meant to be. Sorry

pileum (really!)

mattyd commented: pileum # good word-- mattyd +5
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

Is it true the world is shaped like an egg?

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

beyond human understanding

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

need to be

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

hi am new member here... can anyone give the code of this..i've tried
to figure out the code to finish this but i cant......pls help me.....

Read this

int t,
float l,i;

printf("Enter amount of Loan: ")
scanf("%f", & l);
printf("Enter Interest:");
scanf("%f", & i);
printf("Enter terms(month): ");
scanf("%d", & t)
printf("\n");
for();
printf("%d");

And? Do you have a question that we can actually answer? Maybe a little detail as to what you are trying to do -- task, function, equation, something? And an attempt to do it would be nice. Just putting for(); is not an attempt to do anything.

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

achieved under normal

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

You've basically got it. Did you try it? What happened when you did?

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

Problem #1:

while (! myfile.eof() )     //while the end of file is NOT reached

See this ( .eof() is identical to feof() Problem #2:

system("PAUSE");

See this

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

within the while loop i added another if loop so that is checks ...

it's an if statement. IF is not a loop... ;)

got a the problem mentioned above with the MAX_ALLOWED_TEAMS always being reset to zero when the add team name option is selected, also it only allows me to enter a single word if i enter more than one it messes up the whole thing.

MAX_ALLOWED_TEAMS cannot be reset to 0. That's impossible. The problem is your use of scanf() . This series will explain both what the problem is and how to fix it.


also when adding the match details i need to enter the team to add the details for and instead of creating a new peice of data in the array i need it to add the data to the current data that is already there

So you enter the team number, search for it, display the team name, and accept the new data, and load it into the structure.


Looking at your code:

main()  /**** main is an INT ****/

are you ignoring the comment? It's important!

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

>.< i cant think of a word!

so don't post...

sinistrals

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

latest technologically advanced

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

blueprint for emptiness

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

You need to meet lot unexpected.

Huh? What's that mean?

Insane people are not stupid, just misguided.

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

17 Truths

  • Men are like slinkies...not really good for anything, but you still
    can't help but smile when you see one tumble down the stairs.
  • I read recipes the same way I read science fiction. I get to the end and
    think, "Well, that's not going to happen".
  • Health nuts are going to feel stupid someday, lying in hospitals dying
    of nothing.
  • The other night I ate at a real family restaurant. Every table had an
    argument going.
  • Have you noticed since everyone has a camcorder in the car these days no
    one talks about seeing UFO's like they used to?
  • You know when you're sitting on a chair and you lean back so you're just
    on two legs then you lean too far and you almost fall over but at the
    last second you catch yourself? I feel like that all the time.
  • According to a recent survey, men say that the first thing they notice
    about a woman are their eyes. And women say that the first thing they
    notice about men is that they're a bunch of liars.
  • Whenever I feel blue, I start breathing again.
  • All of us could take a lesson from the weather. It pays no attention to
    criticism.
  • Why does a slight tax increase cost you two hundred dollars and a
    substantial tax cut saves you thirty cents?
  • I'm not …
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague

I'd like a setup like that, except turning my head that much might tire the neck muscles.

Nyah, it strengthens the neck muscles. You'll be able to tow a semi by your neck after a year :mrgreen:

And it needs more ambient light so's I don't go blind.

So hit the light switch on the wall. :p

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

are you all thinking what im thinking?

What? That this thread has degenerated with a lot of meaningless post? Yes.

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

Heh I think a rebellion is afoot... :P

So what else is new:?: :twisted: