My assignment is to use pointers to point at the highest and lowest temperatures in the array.
I need to have 3 pointer variables and start them at the beginning of the array.
Step the pCur through the array using a for loop and pCur++.
Loop through the array looking for the high and low temperatures.
Make an if statement for pLow and PHigh if their values are found then print them out.
The problem I am having here is using pCur to step through the array.
pCur++;
I have no idea what that will do and how it will help find a highest and lowest temperature.
Here is my code
#include <iostream>
using namespace std;
int main(){
float *pCur;
float *pHigh;
float *pLow;
const int MAXTEMPS = 10;
float temps[MAXTEMPS];
int t;
pCur = temps;
pHigh = temps;
pLow = temps;
for (t= 0; t < MAXTEMPS; t++)
{
cout << "Enter a temp: ";
cin >> temps[t];
}
for (t= 0; t < MAXTEMPS; t++)
{
cout << temps[t] << endl;
}
for (t= 0; t < MAXTEMPS; t++)
{
pCur++;
}
system("Pause");
return 0;
}