Originally Posted by
R41D3N
dont use system() . If you want to hold the display screen, better use cin.get();
the way I suggested it, you wouldnt need an if-else block. Rather than user choosing which 2 to keep as is, let them choose which element to modify into the average. So as to get the index.
Code:
#include <iostream>
#include<vectors>
using namespace std;
int main()
{
const int numberofterms=3
cin<<"Input the first number: "<<T[0]<<endl;
cin<<"Input the second number: "<<T[1]<<endl;
cin<<"Input the third number: "<<T[2]<<endl:
Tavg[1] = (T[0]+T[1]+T[2])/numberofterms; // for the mean
cout<<T[0]<<endl;
cout<<Tavg[1]<<endl;
cout<<T[2]<<endl;
cin.get()
return 0;
}
Is that what you mean with no if-else block?