# include %26lt;iostream%26gt;
using namespace std;
void main ()
{
cout %26lt;%26lt; " Mateen Rehman " %26lt;%26lt; endl;
int max = 0;
int max_index = -1;
how do you do this part after this line
create a loop for the user to enter 6 values (double) into an array named prices and
create another loop to determine the max values placed into the array
+ use an array search algorithm shown a few times in the notes
+ update
- max IF (max %26lt; current_index of 'prices')
- max_index
display the MAX VALUE
display the MAX_INDEX
i am not sure what the heck to do with this any help would be appreciated thanks.
Need help in c++?
//Here you can get the values entered
double enteredValues = [6];
for(int i=0; i%26lt;6; i++)
{
cout %26lt;%26lt; "Input value " %26lt;%26lt; i %26lt;%26lt; endl;
cin %26gt;%26gt; enteredValues[i];
}
//Here you can check the values
for(int i=0; i%26lt;6; i++)
{
if( enteredValues[i] %26gt; max )
{
max = enteredValues[i];
max_index = i;
}
}
//Here's how you can output it nice and pretty
cout %26lt;%26lt; endl;
cout %26lt;%26lt; "Largest value input: " %26lt;%26lt; max %26lt;%26lt; endl;
cout %26lt;%26lt; "Largest value index: " %26lt;%26lt; max_index %26lt;%26lt; endl;
Reply:I just put in some code snippets, not a full program. You will need to take my code and adapt it to what you've got.
;) We're not here to do your homework for you. Report It
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment