: Using a while loop, enter ten nubers. Find the largest
: number. You can only declare three int, couter, number , and largest.
: Can someone give me hint on how to solve this problem.
: Don't give the solution.
: Thank you
Okay...
So you're reading in ten numbers. If you've only got three integers to work with then you can't keep all ten numbers around. But you _will_ need to read them in to some variable, so there's an integer gone already. One integer to store the input. That's probably what 'number' is for.
You'll also need to know how many numbers you've read in, so that's what 'counter' is for. You'll probably use this in some sort of loop (a for loop for example).
You'll need to be able to determine the maximum value from the 10 entered. That's what 'largest' is for.
Let's say that you define the value in 'largest' as always being 'the largest value entered so far', rather than 'the largest of 10 values'. Although the definition is a little different, if you enter in 10 values then the value of largest will be the same in both cases.
: : Using a while loop, enter ten nubers. Find the largest
: : number. You can only declare three int, couter, number , and largest.
: : Can someone give me hint on how to solve this problem.
: : Don't give the solution.
: : Thank you
: Okay...
: So you're reading in ten numbers. If you've only got three integers to work with then you can't keep all ten numbers around. But you _will_ need to read them in to some variable, so there's an integer gone already. One integer to store the input. That's probably what 'number' is for.
: You'll also need to know how many numbers you've read in, so that's what 'counter' is for. You'll probably use this in some sort of loop (a for loop for example).
: You'll need to be able to determine the maximum value from the 10 entered. That's what 'largest' is for.
: Let's say that you define the value in 'largest' as always being 'the largest value entered so far', rather than 'the largest of 10 values'. Although the definition is a little different, if you enter in 10 values then the value of largest will be the same in both cases.
: Does that give you any hints?
I understand the first two hits, but I can not figure out the last hint. If you cloud expand on it.
: : : Using a while loop, enter ten nubers. Find the largest
: : : number. You can only declare three int, couter, number , and largest.
: : : Can someone give me hint on how to solve this problem.
: : : Don't give the solution.
: : : Thank you
: : Okay...
: : So you're reading in ten numbers. If you've only got three integers to work with then you can't keep all ten numbers around. But you _will_ need to read them in to some variable, so there's an integer gone already. One integer to store the input. That's probably what 'number' is for.
: : You'll also need to know how many numbers you've read in, so that's what 'counter' is for. You'll probably use this in some sort of loop (a for loop for example).
: : You'll need to be able to determine the maximum value from the 10 entered. That's what 'largest' is for.
: : Let's say that you define the value in 'largest' as always being 'the largest value entered so far', rather than 'the largest of 10 values'. Although the definition is a little different, if you enter in 10 values then the value of largest will be the same in both cases.
: : Does that give you any hints?
: I understand the first two hits, but I can not figure out the last hint. If you cloud expand on it.
: : : Using a while loop, enter ten nubers. Find the largest
: : : number. You can only declare three int, couter, number , and largest.
: : : Can someone give me hint on how to solve this problem.
: : : Don't give the solution.
: : : Thank you
: : Okay...
: : So you're reading in ten numbers. If you've only got three integers to work with then you can't keep all ten numbers around. But you _will_ need to read them in to some variable, so there's an integer gone already. One integer to store the input. That's probably what 'number' is for.
: : You'll also need to know how many numbers you've read in, so that's what 'counter' is for. You'll probably use this in some sort of loop (a for loop for example).
: : You'll need to be able to determine the maximum value from the 10 entered. That's what 'largest' is for.
: : Let's say that you define the value in 'largest' as always being 'the largest value entered so far', rather than 'the largest of 10 values'. Although the definition is a little different, if you enter in 10 values then the value of largest will be the same in both cases.
: : Does that give you any hints?
: I understand the first two hits, but I can not figure out the last hint. If you cloud expand on it.
Comments
: number. You can only declare three int, couter, number , and largest.
: Can someone give me hint on how to solve this problem.
: Don't give the solution.
: Thank you
Okay...
So you're reading in ten numbers. If you've only got three integers to work with then you can't keep all ten numbers around. But you _will_ need to read them in to some variable, so there's an integer gone already. One integer to store the input. That's probably what 'number' is for.
You'll also need to know how many numbers you've read in, so that's what 'counter' is for. You'll probably use this in some sort of loop (a for loop for example).
You'll need to be able to determine the maximum value from the 10 entered. That's what 'largest' is for.
Let's say that you define the value in 'largest' as always being 'the largest value entered so far', rather than 'the largest of 10 values'. Although the definition is a little different, if you enter in 10 values then the value of largest will be the same in both cases.
Does that give you any hints?
: : number. You can only declare three int, couter, number , and largest.
: : Can someone give me hint on how to solve this problem.
: : Don't give the solution.
: : Thank you
: Okay...
: So you're reading in ten numbers. If you've only got three integers to work with then you can't keep all ten numbers around. But you _will_ need to read them in to some variable, so there's an integer gone already. One integer to store the input. That's probably what 'number' is for.
: You'll also need to know how many numbers you've read in, so that's what 'counter' is for. You'll probably use this in some sort of loop (a for loop for example).
: You'll need to be able to determine the maximum value from the 10 entered. That's what 'largest' is for.
: Let's say that you define the value in 'largest' as always being 'the largest value entered so far', rather than 'the largest of 10 values'. Although the definition is a little different, if you enter in 10 values then the value of largest will be the same in both cases.
: Does that give you any hints?
I understand the first two hits, but I can not figure out the last hint. If you cloud expand on it.
Thank you
: : : number. You can only declare three int, couter, number , and largest.
: : : Can someone give me hint on how to solve this problem.
: : : Don't give the solution.
: : : Thank you
: : Okay...
: : So you're reading in ten numbers. If you've only got three integers to work with then you can't keep all ten numbers around. But you _will_ need to read them in to some variable, so there's an integer gone already. One integer to store the input. That's probably what 'number' is for.
: : You'll also need to know how many numbers you've read in, so that's what 'counter' is for. You'll probably use this in some sort of loop (a for loop for example).
: : You'll need to be able to determine the maximum value from the 10 entered. That's what 'largest' is for.
: : Let's say that you define the value in 'largest' as always being 'the largest value entered so far', rather than 'the largest of 10 values'. Although the definition is a little different, if you enter in 10 values then the value of largest will be the same in both cases.
: : Does that give you any hints?
: I understand the first two hits, but I can not figure out the last hint. If you cloud expand on it.
: Thank you
Hi Patel!
Try this...
-----------
#include
void main()
{
int counter=0,largest,number;
cout<<"Enter 10 ints...
";<br>
cout<<counter+1<<": ";<br>
cin>>number;
largest=number;
for(counter=1;counter<10;counter++)<br>
{
cout<<counter+1<<": ";<br>
cin>>number;
largest=(number>largest)?number:largest;
}
cout<<"Max : "<<largest<<endl;<br>
}
Bye!
: : : number. You can only declare three int, couter, number , and largest.
: : : Can someone give me hint on how to solve this problem.
: : : Don't give the solution.
: : : Thank you
: : Okay...
: : So you're reading in ten numbers. If you've only got three integers to work with then you can't keep all ten numbers around. But you _will_ need to read them in to some variable, so there's an integer gone already. One integer to store the input. That's probably what 'number' is for.
: : You'll also need to know how many numbers you've read in, so that's what 'counter' is for. You'll probably use this in some sort of loop (a for loop for example).
: : You'll need to be able to determine the maximum value from the 10 entered. That's what 'largest' is for.
: : Let's say that you define the value in 'largest' as always being 'the largest value entered so far', rather than 'the largest of 10 values'. Although the definition is a little different, if you enter in 10 values then the value of largest will be the same in both cases.
: : Does that give you any hints?
: I understand the first two hits, but I can not figure out the last hint. If you cloud expand on it.
: Thank you
Hi Patel!
Try this...
-----------
#include
void main()
{
int counter=0,largest,number;
cout<<"Enter 10 ints...
";<br>
cout<<counter+1<<": ";<br>
cin>>number;
largest=number;
for(counter=1;counter<10;counter++)<br>
{
cout<<counter+1<<": ";<br>
cin>>number;
largest=(number>largest)?number:largest;
}
cout<<"Max : "<<largest<<endl;<br>
}
Bye!
: number. You can only declare three int, couter, number , and largest.
: Can someone give me hint on how to solve this problem.
: Don't give the solution.
: Thank you
Try this:
int max_of_ten()
{
int i,c,m; /*i-index, c-curent number, m-max number*/
m=read_first_number(); /*Reads first number*/
for(i=1;i<10;i++)<br>
{
c=read_next_number(); /*Whatever you need*/
if(c>m)m=c;
}
return m;
};
Sigh.
Sorry. Short fuse today.